1. 禁用Ubuntu默认的第三方开源的驱动程序nouveau
安装NVIDIA驱动首先需要禁用nouveau驱动,防止冲突,导致无法安装NVIDIA显卡驱动,指令如下:
sudo gedit/etc/modprobe.d/blacklist.conf
打开文件,在最后添加如下两行:
blacklist nouveau
options nouveau modeset=0
2. 更新系统更改
sudo update-initramfs -u
输入指令后重启系统,确保更新到位!
3. 验证nouveau是否已禁用
lsmod | grep nouveau
如果不显示任何信息,则表示禁用成功
4. 下载驱动文件并指令安装
4.1 下载驱动.run文件
在英伟达官方上查找电脑显卡型号相应的驱动,并将起拷贝到HOME目录下,文件为NVIDIA-Linux-x86_64-xxx.run
4.2 安装NVIDIA驱动
- 按ctrl+alt+F1进入后台命令界面,并输入电脑账户名称,账户名密码。
- 关闭图形界面
sudo service lightdm stop
- 卸载系统中存在的驱动
sudo apt-get remove nvidia-*
- 给安装的驱动文件权限
sudo chmod a+x NVIDIA-Linux-x86_64-xxx.run
- 安装驱动
sudo ./NVIDIA-Linux-x86_64-xxx.run -no-x-check -no-nouveau-check -no-opengl-files
- 安装过程中出现:
- He distribution-provide preinstall 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继续
- Would you like to run the nvidia-xconfigutility to automatically update your configuration so that the NVIDIA x driver will be used when you restart x? Any pre-existiong x confile will be backed up. 选择Yes继续
- 安装成功后,重启图形界面
sudo service lightdm start
之后按ctrl+alt+F7返回图形界面 - 打开终端,输入
nvidia-smi
检测是否安装成功。