文章

Ubuntu安装NVIDIA驱动

Ubuntu安装NVIDIA驱动

安装必要工具

1
apt install gcc make

下载安装包

下载到tmp目录:

1
cd /tmp && wget https://cn.download.nvidia.com/XFree86/Linux-x86_64/550.135/NVIDIA-Linux-x86_64-550.135.run

直接执行:

1
chmod +x NVIDIA-Linux-x86_64-550.135.run && ./NVIDIA-Linux-x86_64-550.135.run

后面按照提示操作即可。

为docker添加gpu支持

  1. 配置存储库
1
2
3
4
5
6
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/stable/deb/nvidia-container-toolkit.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
  1. 安装 NVIDIA Container Toolkit 软件包
1
sudo apt-get install -y nvidia-container-toolkit
  1. 配置 Docker 以使用 Nvidia 驱动程序
1
sudo nvidia-ctk runtime configure --runtime=docker && sudo systemctl restart docker
本文由作者按照 CC BY 4.0 进行授权