Ubuntu22.04 装机记录
apt代理
sudo touch /etc/apt/apt.confg
echo "Acquire::http::Proxy "http://10.0.5.66:3128";" >> /etc/apt/apt.confg
安装显卡驱动
Desktop
runfile 安装地址:https://www.nvidia.com/Download/Find.aspx?lang=en-us
系统安装
Software & Update
选择合适的驱动 - apply changes - reboot
这种安装方式会自动禁用Nouveau服务无需手动添加黑名单
Server
搜索驱动
sudo apt search nvidia-driver
系统驱动推荐
ubuntu-drivers devices
通过apt安装
sudo apt install nvidia-driver-535-server
安装Nvidia-Toolkit
- 下载nvidia-toolkit
- 根据自己的系统选择响应的安装包
- 安装
- 配置环境变量
sudo ./cuda_12.2.2_535.104.05_linux.run
sudo vim /etc/profile.d/cuda-config.sh
# 放置一下内容
export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
安装cudnn
安装步骤
前置条件
- Installing NVIDIA Graphics Drivers
- Installing the CUDA Toolkit
- for Linux Installing Zlib
cudnn和CUDA Toolkit、Driver兼容查询
Package Manager 安装方式
- apt
- deb
Tarball 安装方式
# decompress
tar -xvf cudnn-linux-x86_64-8.9.7.29_cuda12-archive.tar.xz
# copy
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*
安装docker
Engine 安装:
- 地址:https://docs.docker.com/engine/install/ubuntu/#Installation%20methods
- 免sudo调用方式:https://docs.docker.com/engine/install/linux-postinstall/
docker hub 代理
sudo vim /etc/docker/daemon.json
# add this
{
"proxies": {
"http-proxy": "http://10.0.5.66:3128",
"https-proxy": "http://10.0.5.66:3128",
"no-proxy": "*.test.example.com,.example.org,127.0.0.0/8"
}
容器内代理
目录不存在需要手动创建
vim .docker/config.json
{
"proxies": {
"default": {
"httpProxy": "http://10.0.5.66:3128",
"httpsProxy": "http://10.0.5.66:3128",
"noProxy": "*.test.example.com,.example.org,127.0.0.0/8"
}
}
}
NVIDIA Container Toolkit安装
安装容器工具
- https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html
配置使用gpu启动容器
- https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html#configuration
安装Pytorch
pip安装
- https://pytorch.org/get-started/previous-versions/
安装Opencv
pip安装
包含GUI版本
- pip install --user opencv-python
- pip install --user opencv-contrib-python
服务器版本(阉割了gui等)
- pip install opencv-python-headless
Onnxruntime
- https://onnxruntime.ai/docs/install/
安装NCCL2
Ubuntu22.04 无法直接从apt中安装nccl库
-
文档页:https://docs.nvidia.com/deeplearning/nccl/install-guide/index.html
-
下载页:https://developer.nvidia.com/nccl
-
选择自己需要的版本进行下载
- 目前测试Local installers 的方式导入的deb仓库无法直接下载,选用Network installers (x86)安装方式,根据自己的系统选择
-
sudo apt update
-
then run the following command to installer NCCL:
Note: If you are using the network repository, the following command will upgrade CUDA to the latest version.
sudo apt install libnccl2 libnccl-dev
安装指定版本:
- For Ubuntu: sudo apt install libnccl2=2.14.3-1+cuda11.7 libnccl-dev=2.14.3-1+cuda11.7
- For RHEL/Centos: sudo yum install libnccl-2.14.3-1+cuda11.7 libnccl-devel-2.14.3-1+cuda11.7 libnccl-static-2.14.3-1+cuda11.7