设置Ubuntu的清华源
按照 Ubuntu 镜像使用帮助提示,设置源,这样无论是下载驱动还是下载程序,都会快很多。首先打开终端,输入
sudo gedit /etc/apt/sources.list
之后在打开的文件中输入如下内容:
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
保存后,更新。
sudo apt update
更新显卡驱动为最新版本
CUDA
在官网下载11.0的最新版本(CUDA Toolkit 11.0 Update 1)。
下载完成后,运行如下命令:
sudo sh cuda_11.0.3_450.51.06_linux.run
取消Driver的安装。
输入如下命令以设置环境变量
sudo gedit ~/.bashrc
在打开的文件末尾添加如下命令:
export PATH=/usr/local/cuda-11.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.0/lib64\
${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
验证
简单验证
nvcc -V
验证CUDA Samples
找到如下路径:
cd /usr/local/cuda/samples/1_Utilities/deviceQuery
sudo make
./deviceQuery
如果正常输出则安装成功。
cuDNN
从官网下载所需的CUDA对应的 cuDNN 版本,这里下载的是cuDNN v8.0.4 for CUDA 11.0 的 cuDNN Library for Linux (x86_64) 版本(只有这个版本是完全匹配的,不会出现类似 linked-against version 8201 != compiled-against version 8004 这样的错误)。
首先解压缩,之后依次复制两个文件夹内容。
tar xvf cudnn-11.0-linux-x64-v8.0.4.30.tgz
sudo cp cuda/include/cudnn*.h /usr/local/cuda/include/
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/
sudo chmod a+r /usr/local/cuda/include/cudnn*.h /usr/local/cuda/lib64/libcudnn*
NCCL
从官网下载CUDA相应版本的NCCL,这里选择的是NCCL 2.10.3, for CUDA 11.0 里的Local installer for Ubuntu 20.04。
安装
sudo dpkg -i nccl-local-repo-ubuntu2004-2.10.3-cuda11.0_1.0-1_amd64.deb
sudo apt-key add /var/nccl-local-repo-ubuntu2004-2.10.3-cuda11.0/7fa2af80.pub
sudo apt update
sudo apt install libnccl2=2.10.3-1+cuda11.0 libnccl-dev=2.10.3-1+cuda11.0
参考链接:libnccl安装
Miniconda
从官网下载,这里选择的是Miniconda3 Linux 64-bit。
打开终端,输入如下命令(注意不要使用sudo)
sh Miniconda3-latest-Linux-x86_64.sh
设置清华源
按照Anaconda 镜像使用帮助,先打开终端,输入如下命令:
conda config --set show_channel_urls yes
先输入如下命令,以创建.condarc文件
conda config --set show_channel_urls yes
打开该文件
sudo gedit ~/.condarc
输入以下内容
channels:
- defaults
show_channel_urls: true
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
MXNet 安装
pip 清华源设置
按照pypi 镜像使用帮助设置,版本是否存在可在这里查找。
pip install pip -U
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
之后创建 gluon 环境
conda create -n gluon python=3.8 pip
conda activate gluon
pip install mxnet-cu110
其他
搜狗输入法
安装Fcitx输入框架
sudo apt install fcitx-bin
sudo apt-get install fcitx-table
在官网下载Linux版狗搜输入法,进入相应的下载目录,进行安装(https://pinyin.sogou.com/linux/)
sudo dpkg -i sougou的文件名.deb
遇到 dpkg: error processing package sogoupinyin (–install): dependency problems - leaving unconfigured
输入 sudo apt-get install -f
中间有提示,输入 Y Do you want to continue? [Y/n] Y
完成安装后重启系统
进行相关设置Settings–>Region&language–>Manage Installed Languages
重新登录后,在右上角出现一个键盘标志,点击进入,选择Configure Current Input Method
进入下面的Input Method界面后,选择+号
进入到Add input method界面,将下面的Only Show Current Language 点掉后,在搜索栏搜索sogoupinyin,选中之后进行添加(建议不要把搜狗输入法移动到第一位,不然按shift切换中英文时,有时输入板会出现乱码)。
zsh
# 设置zsh为默认
sudo apt-get update
sudo apt-get install zsh
sudo usermod -s /usr/bin/zsh $(whoami)
sudo reboot
# 设置字体和主题
sudo apt-get install powerline fonts-powerline
git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ~/powerlevel10k
echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc
# 插件
sudo apt-get install zsh-syntax-highlighting
sudo apt-get install zsh-autosuggestions
echo "source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ~/.zshrc
echo "source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh" >> ~/.zshrc
# 设置oh-my-zsh
sudo apt-get install git
sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
# 初始化 conda
conda init zsh
# Re confige
p10k configure
WeChat/QQ
wget -O- https://deepin-wine.i-m.dev/setup.sh | sh
sudo apt install com.qq.weixin.deepin
参考链接
Ubuntu20.04安装搜狗输入法
Ubuntu20.04下深度学习环境配置(持续维护)
How to Install ZSH Shell on Ubuntu 18.04 LTS
How to Install Deepin WeChat, QQ IM in Ubuntu 20.04 [The Easy Way]