安装驱动
查看显卡型号。
lspci | grep VGA
结果:
01:00.0 VGA compatible controller: NVIDIA Corporation Device 24b0 (rev a1)
Nvidia的驱动在non-free的源里,所以如果没有,需要添加。
sudo vim /etc/apt/sources.list
添加:
deb http://mirrors.163.com/debian/ bullseye main non-free contrib
deb http://mirrors.163.com/debian/ bullseye-updates main non-free contrib
deb http://mirrors.163.com/debian/ bullseye-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ bullseye main non-free contrib
deb-src http://mirrors.163.com/debian/ bullseye-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ bullseye-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ bullseye/updates main non-free contrib
deb-src http://mirrors.163.com/debian-security/ bullseye/updates main non-free contrib
执行一下update
sudo apt update
可以看一下是不是有了nvidia的软件包。
apt list nvidia*
如果有了,安装就行了。
安装前,可以先安装nvidia的工具检测一下:
sudo apt install nvidia-detect
nvidia-detect
可以根据提示进行安装了。
sudo apt install nvidia-driver firmware-misc-nonfree -y
安装完成后运行:
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.
原来是因为Secure Boot,在主板的Bios设置中把这个选项关闭就可以了。
安装cuda
sudo apt install nvidia-cuda-dev nvidia-cuda-toolkit
再运行
nvidia-smi
就能够看到cuda的版本信息了。
老杨的分享真实太棒了!风格和内容均完美无缺。
有个问题请指教:我在安装驱动的步骤出现下面的反馈,似乎是有个依赖项不能安装,请问该怎么办呀?
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
nvidia-driver : Depends: xserver-xorg-video-nvidia (= 470.103.01-1~bpo11+1) but it is not going to be installed
Depends: nvidia-support but it is not installable
E: Unable to correct problems, you have held broken packages.