Deep learning environment configuration - ubuntu20.04 install nvidia driver

deep learning

1. Install the NVIDIA driver

First, you need to install the graphics driver according to the NVIDIA graphics card model. Go to NVIDIA's official website and check the driver for your GPU. Select the GPU product type (take NVIDIA GT 1030 as an example), and find the suitable driver as shown in the figure below:
insert image description here
The found driver version is as follows:
Download the NVIDIA driver installation package (.run format).
The installation of the run format file is more troublesome. First, disable the nouveau driver. Nouveau is an open source 3D driver developed by a third party for NVIDIA graphics cards. Ubuntu comes with the Nouveau driver integrated by default. And Nouveau became a hindrance when users installed NVIDIA's official private drivers. If Nouveau is not disabled, an error is always reported during installation.

2. Disable nouveau

nouveau disables commands from writing to files

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

Add the following statement at the end of the file:

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

Update the file you just modified

sudo update-initramfs -u

reboot to restart the computer, open the terminal to check if nouveau is disabled

lsmod | grep nouveau 

If this sentence is executed, there is no output from the terminal, then nouveau is successfully disabled

3. Installation preparation

If you do not prepare before installation, you will be prompted to install the package
insert image description here

1. Install GCC, g++, make

You must install gcc before installing the gpu driver.

sudo apt-get  install  build-essential 
gcc --version 验证gcc是否安装成功
sudo apt-get install g++
sudo apt-get install make

2. Uninstall the old driver

If you are installing the gpu driver for the first time, this step can be omitted. Of course, if you are not installing the driver for the first time, you need to uninstall the previous driver (it can also be used without uninstalling the actual measurement)

sudo apt-get remove --purge nvidia*

Fourth, install the driver

The graphical interface must be closed to install the driver, otherwise the installation will fail.
enter tty mode

ctrl + alt+ F1 或 ctrl + alt+ F2 或 ctrl + alt+ F3,视情况

enter

sudo service lightdm stop

Switch to the specified directory of the NVIDIA installation package, grant permissions and install it

cd ~/Downloads 
mv NVIDIA-Linux-x86_64-470.63.01.run nvidia.run 
chmod +x nvidia.run 
sudo sh nvidia.run ‐‐no‐opengl-files

No is preceded by a double bar.
When you encounter the option that displays 32bits, select NO, and select YES for others, and then wait for the installation
insert image description here
. After the installation is complete, restart, and use nvidia-smi
insert image description here
to view it. You are done here.

Guess you like

Origin blog.csdn.net/qq_51963216/article/details/124194096