ubuntu16 build a deep learning environment (1)-install nvidia driver


Reference link: add link description

1. Check the computer graphics card

lshw -c video

As a result, you can see your computer graphics card model, my laptop graphics card is Geforce 940M

2. Download the driver for the corresponding graphics card

NVIDIA official website: download drivers search and download the driver model required by the graphics card.
Insert picture description here
From the results, we can see that my driver version is 440.100.
Insert picture description hereConfirm again. You can use the following command to view the available drivers:

ubuntu-drivers devices

Insert picture description hereThe result shows that the recommended driver version is nvidia-384 does not match the searched version. The online tutorial recommends installing the recommended version 384 driver, but I really can’t find it and can only download the 440 version.

3. Disable nouveau

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

Add these two lines at the end of the .conf file, save and exit:

blacklist nouveau
options nouveau modeset=0

Excuting an order:

sudo update-initramfs -u  //应用更改

Restart the system and enter the command to verify whether nouveau is disabled. If no information is returned, it means it is disabled.

lsmod | grep nouveau

4. Install NVIDIA driver

Enter the command line interface:

Ctrl+Alt+F1 //输入用户名和密码登录即可
sudo service lightdm stop //关闭图形界面
Ctrl+Alt+F7  //退出命令行界面

Uninstall the old version of nvidia driver: (you don't need to perform this step for the first installation)

sudo apt-get remove --purge nvidia*

Start to install the driver:

sudo chmod  a+x NVIDIA-Linux-x86_64-440.100.run //给驱动run文件赋予执行权限,对应自己下载的驱动名称
sudo ./NVIDIA-Linux-x86_64-396.18.run -no-x-check -no-nouveau-check -no-opengl-files //只有禁用opengl这样安装才不会出现循环登陆的问题

-no-x-check: turn off the X service when installing the driver
-no-nouveau-check: disable nouveau when installing the driver
-no-opengl-files: install only the driver files, do not install OpenGL files
Options for the installation process:
no screenshots, follow The reference tutorial is not the same, it seems to keep pressing the default.
Open the graphical interface:

Ctrl+Alt+F1 
sudo service lightdm start  //打开图像界面
Ctrl+Alt+F7

5. Check if the installation is successful

nvidia-smi

Insert picture description here

Guess you like

Origin blog.csdn.net/qq_43265072/article/details/107160297