参考链接
Ubunut20.04/22.04安装NVIDIA驱动ubuntu20.04关闭内核自动更新、禁止/取消系统自动更新下载显卡驱动
官方驱动 | NVIDIA

注意,如果你的系统路径是中文的话,建议新建一个英文路径,将.run文件移动到路径下,便于之后命令行操作,比如
mkdir ~/downloadmv NVIDIA-Linux-x86_64-430.26.run ~/download 准备工作
安装必要软件
sudo apt updatesudo apt install build-essential 卸载原有驱动
sudo apt-get remove --purge nvidia* 禁用nouveau
sudo apt install vimsudo vim /etc/modprobe.d/blacklist.conf 在blacklist末尾添加
blacklist nouveauoptions nouveau modeset=0 输入如下更新
sudo update-initramfs -u 然后重启reboot
重启后输入
lsmod | grep nouveau 没有输出即禁用成功
确定当前系统使用的display manager
$ cat /etc/X11/default-display-manager/usr/sbin/gdm3 比如本系统使用的就是gdm3
安装显卡驱动
进入非图形化界面
sudo telinit 3 关闭显示
sudo service gdm3 stop 接着安装
cd ~/downloadsudo chmod a+x NVIDIA-Linux-x86_64-550.78.runsudo ./NVIDIA-Linux-x86_64-550.78.run --no-opengl-files 安装过程中
1.The distribution-provided pre-install script failed! Are you sure you want to continue?选择continue installation2.Would you like to register the kernel module souces with DKMS? This will allow DKMS to automatically build a new module, if you install a different kernel later? 选择 No 继续。3.问题大概是:Nvidia's 32-bit compatibility libraries? 选择 No 继续。4.Would you like to run the nvidia-xconfigutility to automatically update your x configuration so that the NVIDIA x driver will be used when you restart x? Any pre-existing x confile will be backed up. 选择 No 继续 安装完成,开启显示
sudo service gdm3 start 打开终端,输入nvidia-smi即可看到显卡驱动安装完成
禁用系统和内核更新
由于ubuntu默认启动了自动更新内核,会使得我们的显卡驱动版本无法匹配内核版本,导致经常需要重装显卡驱动。
禁用内核更新
sudo vi /etc/apt/apt.conf.d/10periodicsudo vi /etc/apt/apt.conf.d/20auto-upgrades 将所有参数值都设为0,然后重启系统
禁用系统更新
打开Software & Updates(软件和更新), 按照如下设置
