Install Nvidia drivers on Ubuntu 18.04 LTS

Follow these steps to install nvidia drivers on Ubuntu 18.04 LTS.


# get rid of existing nvidia related drivers on your system. 
sudo apt-get purge nvidia-*

# add the repository for graphics drivers
sudo add-apt-repository ppa:graphics-drivers/ppa

# update package lists
sudo apt update

# install the necessary drivers
sudo ubuntu-drivers autoinstall

# Reboot! .. Installation complete.
shutdown -r now


To check that the install was successful, after the reboot try the command



nvidia-smi


Your output will include driver and hardware details like these.

Mon May 18 14:05:00 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.82       Driver Version: 440.82       CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 1080    Off  | 00000000:01:00.0  On |                  N/A |
|  0%   43C    P5    13W / 200W |    619MiB /  8118MiB |      1%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1559      G   /usr/lib/xorg/Xorg                            30MiB |
|    0      1618      G   /usr/bin/gnome-shell                          49MiB |
|    0      1798      G   /usr/lib/xorg/Xorg                           283MiB |
|    0      1958      G   /usr/bin/gnome-shell                         123MiB |
|    0      2460      G   ...uest-channel-token=14799922906447784644     7MiB |
|    0      3806      G   ...AAAAAAAAAAAACAAAAAAAAAA= --shared-files   118MiB |
+-----------------------------------------------------------------------------+

That's it folks. Bookmark these essential steps for future problems with nvidia drivers.