ubuntu20.04 安装显卡驱动

参考链接

下载显卡驱动

官方驱动 | NVIDIA
在这里插入图片描述
注意,如果你的系统路径是中文的话,建议新建一个英文路径,将.run文件移动到路径下,便于之后命令行操作,比如

mkdir ~/download
mv NVIDIA-Linux-x86_64-430.26.run ~/download

准备工作

安装必要软件

sudo apt update
sudo apt install build-essential

卸载原有驱动

sudo apt-get remove --purge nvidia*

禁用nouveau

sudo apt install vim
sudo vim /etc/modprobe.d/blacklist.conf

blacklist末尾添加

blacklist nouveau
options 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 ~/download
sudo chmod a+x NVIDIA-Linux-x86_64-550.78.run
sudo ./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 installation
2.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/10periodic
sudo vi /etc/apt/apt.conf.d/20auto-upgrades

将所有参数值都设为0,然后重启系统

禁用系统更新

打开Software & Updates(软件和更新), 按照如下设置

在这里插入图片描述

  • 3
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值