# Ubuntu Server Install Nvidia Driver
# 添加Graphics Drivers PPA
PPA(Personal Package Archive)是一种用于在Ubuntu中安装软件的方式。输入以下命令将Graphics Drivers PPA添加到系统中:
$ sudo add-apt-repository ppa:graphics-drivers/ppa
按下回车后,系统可能会要求你输入管理员密码。
# 更新软件包信息
执行以下命令来更新软件包信息:
$ sudo apt update
# 查找NVIDIA驱动
执行下列命令查询NVIDIA驱动
$ sudo apt list nvidia-driver-*
[sudo] password for ubuntu:
Listing... Done
nvidia-driver-390/jammy-updates,jammy-security,jammy 390.157-0ubuntu0.22.04.2 amd64
nvidia-driver-418-server/jammy-updates,jammy-security 418.226.00-0ubuntu5~0.22.04.1 amd64
nvidia-driver-418/jammy 430.50-0ubuntu3 amd64
nvidia-driver-430/jammy 440.100-0ubuntu1 amd64
nvidia-driver-435/jammy 455.45.01-0ubuntu1 amd64
nvidia-driver-440-server/jammy-updates,jammy-security 450.248.02-0ubuntu0.22.04.1 amd64
nvidia-driver-440/jammy 450.119.03-0ubuntu1 amd64
nvidia-driver-450-server/jammy-updates,jammy-security 450.248.02-0ubuntu0.22.04.1 amd64
nvidia-driver-450/jammy 460.91.03-0ubuntu1 amd64
nvidia-driver-455/jammy 460.91.03-0ubuntu1 amd64
nvidia-driver-460-server/jammy-updates,jammy-security 470.199.02-0ubuntu0.22.04.1 amd64
nvidia-driver-460/jammy-updates,jammy-security,jammy 470.199.02-0ubuntu0.22.04.1 amd64
nvidia-driver-465/jammy-updates,jammy-security,jammy 470.199.02-0ubuntu0.22.04.1 amd64
nvidia-driver-470-server/jammy-updates,jammy-security 470.199.02-0ubuntu0.22.04.1 amd64
nvidia-driver-470/jammy-updates,jammy-security,jammy,now 470.199.02-0ubuntu0.22.04.1 amd64 [installed]
nvidia-driver-495/jammy-updates,jammy-security 510.108.03-0ubuntu0.22.04.1 amd64
nvidia-driver-510-server/jammy-updates,jammy-security 515.105.01-0ubuntu0.22.04.1 amd64
nvidia-driver-510/jammy-updates,jammy-security,jammy 525.125.06-0ubuntu0.22.04.1 amd64
nvidia-driver-515-open/jammy-updates,jammy-security,jammy 525.125.06-0ubuntu0.22.04.1 amd64
nvidia-driver-515-server/jammy-updates,jammy-security 525.125.06-0ubuntu0.22.04.1 amd64
nvidia-driver-515/jammy-updates,jammy-security,jammy 525.125.06-0ubuntu0.22.04.1 amd64
nvidia-driver-520-open/jammy-updates,jammy-security,jammy 525.125.06-0ubuntu0.22.04.1 amd64
nvidia-driver-520/jammy-updates,jammy-security,jammy 525.125.06-0ubuntu0.22.04.1 amd64
nvidia-driver-525-open/jammy-updates,jammy-security,jammy 525.125.06-0ubuntu0.22.04.1 amd64
nvidia-driver-525-server/jammy-updates,jammy-security 525.125.06-0ubuntu0.22.04.1 amd64
nvidia-driver-525/jammy-updates,jammy-security,jammy 525.125.06-0ubuntu0.22.04.1 amd64
nvidia-driver-530-open/jammy 535.104.05-0ubuntu0.22.04.1 amd64
nvidia-driver-530/jammy 535.104.05-0ubuntu0.22.04.1 amd64
nvidia-driver-535-open/jammy 535.104.05-0ubuntu0.22.04.1 amd64
nvidia-driver-535-server-open/jammy-updates,jammy-security 535.54.03-0ubuntu0.22.04.1 amd64
nvidia-driver-535-server/jammy-updates,jammy-security 535.54.03-0ubuntu0.22.04.1 amd64
nvidia-driver-535/jammy 535.104.05-0ubuntu0.22.04.1 amd64
nvidia-driver-core-535-open/jammy 535.104.05-0ubuntu0.22.04.1 amd64
nvidia-driver-core-535/jammy 535.104.05-0ubuntu0.22.04.1 amd64
nvidia-driver-lrm-535-open/jammy 535.104.05-0ubuntu0.22.04.1 amd64
nvidia-driver-lrm-535/jammy 535.104.05-0ubuntu0.22.04.1 amd64
# 安装NVIDIA驱动
安装NVIDIA显卡驱动的命令会根据你的显卡型号和系统需求而有所不同。一般来说,你可以使用以下命令来安装推荐的稳定版本驱动:
$ sudo apt install nvidia-driver-<版本号>
在上面的命令中,将<版本号>替换为你想要安装的驱动版本号。例如,如果要安装版本号为470的驱动,命令将是:
$ sudo apt install nvidia-driver-470
# 重启系统
安装完成后,重新启动系统以使新的驱动生效。
# 验证驱动安装
安装完成后,你可以使用以下命令来验证驱动是否正确安装:
$ nvidia-smi
Wed Aug 30 05:39:41 2023
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.199.02 Driver Version: 470.199.02 CUDA Version: 11.4 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA GeForce ... Off | 00000000:01:00.0 Off | N/A |
| 0% 61C P0 118W / 350W | 0MiB / 24268MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
| 1 NVIDIA GeForce ... Off | 00000000:05:00.0 Off | N/A |
| 0% 57C P0 100W / 350W | 0MiB / 24268MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+
如上该命令显示了关于NVIDIA显卡的信息,那么驱动安装成功。