实例规格:轻量级 GPU 实例 vgn6i-vws / ecs.vgn6i-m4-vws.xlarge(4vCPU 23GiB)
操作系统:Ubuntu 22.04
第一部分:尝试失败的安装方法
查询 NVIDIA 产品型号
lspci | grep -i nvidia
输出
00:07.0 VGA compatible controller: NVIDIA Corporation TU104GL [Tesla T4] (rev a1)
根据产品型号去 NVIDIA 官网下载驱动
wget -c https://us.download.nvidia.cn/tesla/535.154.05/nvidia-driver-local-repo-ubuntu2204-535.154.05_1.0-1_amd64.deb
安装驱动
cp /var/nvidia-driver-local-repo-ubuntu2204-535.154.05/nvidia-driver-local-91B8C5A2-keyring.gpg /usr/share/keyrings/
dpkg -i nvidia-driver-local-repo-ubuntu2204-535.154.05_1.0-1_amd64.deb
apt update
apt install nvidia-driver-535 nvidia-dkms-535
reboot
重启后运行 nvidia-smi
命令却出现下面的错误,驱动没有安装成功
NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.
接着用 ubuntu-drivers devices
命令查看 nvidia 驱动版本
modalias : pci:v000010DEd00001EB8sv000010DEsd0000130Ebc03sc00i00
vendor : NVIDIA Corporation
model : TU104GL [Tesla T4]
manual_install: True
driver : nvidia-driver-470-server - distro non-free
driver : nvidia-driver-470 - distro non-free
driver : nvidia-driver-525-server - distro non-free
driver : nvidia-driver-418-server - distro non-free
driver : nvidia-driver-535-server - distro non-free
driver : nvidia-driver-545 - distro non-free
driver : nvidia-driver-525 - distro non-free recommended
driver : nvidia-driver-450-server - distro non-free
driver : xserver-xorg-video-nouveau - distro free builtin
然后用下面的命令安装
apt install nvidia-driver-525-server
重启后问题依旧
第二部分:正确的安装方法
在阿里云官网找到这篇帮助文档——在GPU虚拟化型实例中安装GRID驱动(Linux),通过下面的命令成功完成了安装
if acs-plugin-manager --list --local | grep grid_driver_install > /dev/null 2>&1
then
acs-plugin-manager --remove --plugin grid_driver_install
fi
acs-plugin-manager --exec --plugin grid_driver_install
nvidia-smi
命令输出结果: