系统环境:ubuntu20.04
echo "blacklist nouveau">>/etc/modprobe.d/blacklist.conf echo "options nouveau modeset=0">>/etc/modprobe.d/blacklist.conf sudo update-initramfs -u
sudo apt-get install -y gcc make build-essential
sudo chmod a+x NVIDIA-Linux-x86_64-xxx.xx.run
sudo ./NVIDIA-Linux-x86_64-xxx.xx.run -no-x-check -no-nouveau-check -no-opengl-files
sudo ./cuda_xxx_linux.run
请注意取消选择安装驱动第一个x去掉,x代表选中
2. 配置cuda路径
sudo vim ~/.bashrc
添加如下内容
$ export PATH=/usr/local/cuda/bin${PATH:+:${PATH}} $ export LD_LIBRARY_PATH=/usr/local/cuda/lib64\ ${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
source ~/.bashrc
tar -xf xx.archive.tar.xz
复制到对应文件夹下
sudo cp include/cudnn.h /usr/local/cuda/include sudo cp lib/libcudnn* /usr/local/cuda/lib64 sudo chmod a+r /usr/local/cuda/include/cudnn.h sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
sudo apt-get remove docker docker-engine docker.io containerd runc sudo apt-get update sudo apt-get install \ ca-certificates \ curl \ gnupg \ lsb-release sudo mkdir -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update sudo chmod a+r /etc/apt/keyrings/docker.gpg sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin sudo docker run hello-world
设置权限问题
报:Got permission denied while trying to connect to the Docker daemon socket at
sudo gpasswd -a nvidia docker newgrp docker
curl https://get.docker.com | sh \ && sudo systemctl --now enable docker distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \ && curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \ && curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | \ sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \ sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list sudo apt-get update sudo apt-get install -y nvidia-docker2 sudo systemctl restart docker sudo docker run --rm --gpus all nvidia/cuda:11.0.3-base-ubuntu20.04 nvidia-smi
vim /etc/docker/daemon.json
将以下内容写入
{ "insecure-registries":["http://xx.xxx.xx.xx:xxxx"] }
再次读入配置信息,并启动
sudo systemctl daemon-reload sudo systemctl restart docker
sudo apt install -y net-tools vim sudo apt install -y --no-install-recommends openssh-server service ssh start
原文链接:https://blog.csdn.net/weixin_44003563/article/details/127616631
© 版权声明
声明📢本站内容均来自互联网,归原创作者所有,如有侵权必删除。
本站文章皆由CC-4.0协议发布,如无来源则为原创,转载请注明出处。
THE END