Ubuntu离线安装Nvidia显卡驱动

离线安装:

去官网下载需要的显卡驱动,以NVIDIA-Linux-x86_64-440.31.run为例。
下载后的run文件拷贝至home目录下。
1.禁用 nouveau驱动
lsmod | grep nouveau # 查看有没有输出,如果有信息输出,则需要禁掉

sudo gedit /etc/modprobe.d/blacklist.conf

在blacklist.conf的最后添加下面几行:

blacklist nouveau
options nouveau modeset=0

保存,关闭
更新

sudo update-initramfs -u

重启

lsmod | grep nouveau # 查看有没有输出,如果没有任何信息输出,则说明ok

2.进入tty模式进行安装
Ctrl+Alt+F1进入文本模式
sudo service lightdm stop # 关闭图形界面
然后卸载掉原有驱动:

 sudo apt-get remove nvidia-*  

给驱动run文件赋予执行权限:

 sudo chmod  a+x NVIDIA-Linux-x86_64-440.31.run

安装:

sudo sh NVIDIA-Linux-x86_64-440.31.run --no-opengl-files –no-x-check –no-nouveau-check

–no-opengl-files 只安装驱动文件,不安装OpenGL文件。这个参数最重要
–no-x-check 安装驱动时不检查X服务
–no-nouveau-check 安装驱动时不检查nouveau
后面两个参数可不加。
如果在装的过程中出现以下信息,请选择:
The distribution-provided pre-install script failed! Are you sure you want to continue?
选择 yes 继续。
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 继续。
Nvidia’s 32-bit compatibility libraries?
选择 No 继续。
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 继续
3
sudo service lightdm restart # 重新开启图形界面
nvidia-smi # 查看是否安装成功

如果遇到显卡驱动原因导致的开机不成功可参考:

ubuntu显卡驱动原因导致开机显示:clean,files,blocks无法开机

猜你喜欢

转载自blog.csdn.net/qq_41915226/article/details/103052058
今日推荐