Ubuntu 22.04 安装英伟达驱动
1、官网下载驱动
https://www.nvidia.cn/Download/index.aspx?lang=cn#
2、更新软件,注意一定要安装 gcc-12,不能是gcc-11
sudo apt-get updatesudo apt-get install g++sudo apt-get install gcc-12sudo apt-get install make
可以通过 gcc -v 查看版本,切换 gcc 版本可以参考这篇文章Ubuntu 切换GCC版本_ubuntu切换gcc版本-CSDN博客
3、禁用默认驱动
sudo vim /etc/modprobe.d/blacklist.conf
末尾添加
blacklist nouveau
options nouveau modeset=0
更新驱动
sudo update-initramfs -u
然后一定要重启,然后输入
lsmod | grep nouveau
无输出则表示禁用成功
3、进入 TTY
1、关闭图形页面
sudo telinit 3
打开的话输入 sudo telinit 5
2、禁用 x-server
sudo service gdm3 stop
3、赋予安装包权限,并执行
sudo chmod +x NVIDIA-Linux-x86_64-525.53.runsudo ./NVIDIA-Linux-x86_64-525.53.run
安装过程中会碰到几个选项
1、An alternate method of installing the NVIDIA driver was detected.......选择 Continue Installation
2、如果碰到 the target kernel has CONFIG_MODULE_SIG set......,则 ctrl C 中断安装,进入 BIOS 将 “安全启动/Security”改为 Disabled,然后重新启动并执行安装。
3、Install Nvidia's 32-bit compatibility libraries? 选择 No
4、Would you like to run the nvidia-xconfig utility to automatically update your X configuration.....选择 Yes
4、安装成功后返回图形化页面
sudo service gdm3 start
测试是否成功
nvidia-smi