tag: #Linux #Ubuntu
设备:R9000P 2021
系统:win11 + ubuntu22.04
使用 UltraISO 制作启动U盘。
UltraISO下载链接:https://cn.ultraiso.net/xiazai.html
Ubuntu镜像下载链接:https://cn.ubuntu.com/download/desktop
制作完成后,插入U盘,重启,按下F2键进入bios,将U盘启动设置为第一位,保存退出,进入Ubuntu系统安装界面,根据引导进行系统安装。
电脑磁盘分区格式为GPT,使用UEFI引导,分区如下
分区 | 大小 | 格式 | 类型 |
---|---|---|---|
uefi | 500M | UEFI | 主分区 |
swap | 16G | SWAP | 逻辑分区 |
/ | 200G | ext4 | 主分区 |
/home | 500G | ext4 | 逻辑分区 |
注:MBR分区格式,使用Legacy启动模式,uefi分区更改为 /boot 分区
sudo apt install ntpdate
sudo ntpdate time.windows.com
sudo hwclock --localtime --systohc
sudo gedit /etc/default/grub
# 修改 GRUB_DEFAULT=2
# 0 默认启动为ubuntu;2 默认启动为win
sudo update-grub
sudo vim /etc/sudoers
# 在 %sudo ALL=(ALL:ALL) ALL 这一行的下一行添加
username ALL=(ALL) NOPASSWD:ALL
gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'minimize'
参考官方文档:https://shurufa.sogou.com/linux/guide
sudo apt install flameshot
设置快捷方式:
设置 -> 键盘 -> 键盘快捷键 -> 自定义快捷键 -> 添加如下内容
名称:flameshot截图
命令:flameshot gui
快捷键:super + shift + s
snap list
名称 | 版本 | 修订版本 | 追踪 | 发布者 | 注记 |
---|---|---|---|---|---|
bare | 1.0 | 5 | latest/stable | canonical✓ | base |
core20 | 20221212 | 1778 | latest/stable | canonical✓ | base |
gnome-3-38-2004 | 0+git.6f39565 | 119 | latest/stable/… | canonical✓ | - |
gtk-common-themes | 0.1-81-g442e511 | 1535 | latest/stable/… | canonical✓ | - |
snap-store | 41.3-66-gfe1e325 | 638 | latest/stable/… | canonical✓ | - |
snap-store-proxy | 2.22 | 92 | latest/stable | canonical✓ | - |
snapd | 2.58 | 17950 | latest/stable | canonical✓ | snapd |
snapd-desktop-integration | 0.1 | 49 | latest/stable/… | canonical✓ | - |
sudo snap remove --purge snap-store
sudo snap remove --purge gnome-3-38-2004
sudo snap remove --purge gtk-common-themes
sudo snap remove --purge snapd-desktop-integration
sudo snap remove --purge snap-store-proxy
sudo snap remove --purge bare
sudo snap remove --purge core20
sudo snap remove --purge snapd
sudo apt remove --autoremove snapd
rm -rf ~/snap
sudo rm -rf /snap
sudo rm -rf /var/snap
sudo rm -rf /var/lib/snapd
sudo rm -rf /var/cache/snapd
# 新建文件
sudo gedit /etc/apt/preferences.d/nosnap.pref
# 添加以下的内容
Package: snapd
Pin: release a=*
Pin-Priority: -10
# 保存退出
sudo apt update
sudo apt install --install-suggests gnome-software
sudo rm /etc/apt/preferences.d/nosnap.pref
sudo apt update
sudo apt upgrade
sudo snap install snap-store
sudo apt install firefox
# 安装zsh
sudo apt install zsh
# 安装oh-my-zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
或
sh -c "$(wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
# 若上述安装失败,手动安装,参考如下
https://github.com/robbyrussell/oh-my-zsh
# zsh主题
# powerlevel10k主题:https://github.com/romkatv/powerlevel10k
git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
在 ~/.zshrc 中,设置 ZSH_THEME="powerlevel10k/powerlevel10k"
# 插件设置
常用的两个插件是
zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
在 ~/.zshrc 中设置 plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
# 修改默认 shell 为 zsh
chsh -s $(which zsh)
# 修改 .bashrc 文件
export PS1='\e[0;31m\]\342\224\214\342\224\200\e[1;32m\][\e[1m\]\e[3;35m\]\u\e[0m\]@\e[1;33m\]\H\e[1;32m\]][\e[1;34m\]\t\e[1;32m\]] \e[1;30m\]\e[3;30m\]$PWD\e[0m\]\n\e[0;31m\]\342\224\224\342\224\200\342\224\200\342\225\274 \e[0m\]\$ '
# open命令,打开当前目录
alias open='nautilus .'
# 参考地址
https://github.com/Mayccoll/Gogh
方式1:在 gnome-look 选择 grub 主题,按步骤安装
链接:https://www.gnome-look.org/browse?cat=109&ord=latest
方式2:使用GitHub上的开源项目
链接:https://github.com/vinceliuice/grub2-themes
略
版本选择:
miniconda:Miniconda3-py39_22.11.1-1-Linux-x86_64
python = 3.9
pytorch = 1.12.1
torchvision = 0.13.1
torchaudio = 0.12.1
cudatoolkit = 11.6
cudnn = 8.7.0 for CUDA 11.x
miniconda安装
下载链接:https://docs.conda.io/en/latest/miniconda.html
conda相关配置
镜像:https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/
创建pytorch虚拟环境:conda create -y -n env_name python=3.9
pytorch安装
conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=11.6 -c pytorch -c conda-forge
wget https://developer.download.nvidia.com/compute/cuda/11.6.2/local_installers/cuda_11.6.2_510.47.03_linux.runsudo
sh cuda_11.6.2_510.47.03_linux.run
# 环境变量设置
export PATH=/usr/local/cuda-11.6/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.6/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
tar包安装方式如下:
# Unzip the cuDNN package.
tar -xvf cudnn-linux-x86_64-8.x.x.x_cudaX.Y-archive.tar.xz
# Copy the following files into the CUDA toolkit directory.
sudo cp cudnn-*-archive/include/cudnn*.h /usr/local/cuda/include
sudo cp -P cudnn-*-archive/lib/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn*.h /usr/local/cuda/lib64/libcudnn*