Ubuntu 16.04 Nvidia驱动安装

安装好好多天的Nvidia驱动,在用 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.

试过了很多方法,最后总算是安装成功了,在此记录一下(仅记录我的成功过程,不代表每个人都可以用此方法成功。在安装的过程中我也参考过其他的博客,也失败过很多次,不一定说明别人的就是错的,每个人遇到的情况可能都不一样)。

1、查看显卡信息:

 

$ lspci | grep VGA

 

 

2、下载驱动程序:

http://www.nvidia.cn/Download/index.aspx

下载完之后是一个名称为 NVIDIA-Linux-x86_64-xxx.xx.run 的文件。

 

3、删除原有驱动(可选):

 

$ sudo apt-get remove --purge nvidia*

 

 

4、禁用nouveau驱动:

编辑 /etc/modprobe.d/blacklist-nouveau.conf 文件,添加以下内容:

 

blacklist nouveau
blacklist lbm-nouveau
options nouveau modeset=0
alias nouveau off
alias lbm-nouveau off


然后保存。
关闭nouveau:

 

 

 

 

$ echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf

 

 

 

5、重启:

 

$ update-initramfs -u
$ sudo reboot


6、获取Kernel source(非常重要):

 

 

 

 

$ apt-get install linux-source
$ apt-get install linux-headers-x.x.x-x-generic


第一步执行过程中会出现如图所示的提示信息:

 

 

 

图中红色部分中的版本号就是第二步中x.x.x-x需要替换的部分。
 

7、安装Nvidia驱动:

 

$ sudo sh ./NVIDIA-Linux-x86_64-xxx.xx.run


安装过程中一些选项(有一些问题记不清楚了,只给出需要选择的选项:):
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 继续。
问题没记住,选项是:install without signing
问题大概是: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.  选择 Yes  继续

 

 

 

8、挂载Nvidia驱动:

 

 

$ modprobe nvidia


9、检查驱动是否安装成功:

 

 

 

 

$ nvidia-smi


如果出现如下提示,则说明安装成功:

 

 

 

  • 15
    点赞
  • 71
    收藏
    觉得还不错? 一键收藏
  • 16
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 16
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值