KB 148484 - Installing NVIDIA Drivers on Ubuntu

KB 148484 - Installing NVIDIA Drivers on Ubuntu

Ubuntu doesn't come with NVIDIA drivers installed by default as they are proprietary and closed-source. This means that you'll have issues like poor performance, displays not working, artifacts etc... while using the FOSS nouveau drivers.

Graphical Install

The easiest and best way to install NVIDIA drivers if from the Software Center / Additional Drivers app. Just click on the desired driver version, install it and reboot.

If that doesn't work or if you have no video output after boot, you may follow the Command Line Install guide:

Command Line Install

No Display Fix

If you have no display output owing to broken drivers, you can hit Alt+Ctrl+F1 (or F2) to switch to the terminal. Now login using your username and password and proceed.

Install Kernel Headers

The NVIDIA driver requires that the kernel headers and development packages for the running version of the kernel be installed at the time of the driver installation, as well whenever the driver is rebuilt. For example, if your system is running kernel version 4.4.0, the 4.4.0 kernel headers and development packages must also be installed. The kernel headers and development packages for the currently running kernel can be installed with:

$ sudo apt-get install linux-headers-$(uname -r)

Install the CUDA GPG key

Now you have to Install the CUDA repository public GPG key. This can be done via the cuda-keyring package or a manual installation of the key. The usage of apt-key is deprecated.

$ distribution=$(. /etc/os-release;echo $ID$VERSION_ID | sed -e 's/\.//g')
$ wget https://developer.download.nvidia.com/compute/cuda/repos/$distribution/x86_64/cuda-keyring_1.0-1_all.deb
$ sudo dpkg -i cuda-keyring_1.0-1_all.deb

Install Drivers

Update the APT repository cache and install the driver using the cuda-drivers meta-package. Use the --no-install-recommends option for a lean driver install without any dependencies on X packages. This is particularly useful for headless installations on cloud instances.


$ sudo apt update
$ sudo apt -y install cuda-drivers

After this you must also install the cuda-toolkit package for working with CUDA and GPU accelerated applications

$ sudo apt install -y nvidia-cuda-toolkit

Reboot your machine. $sudo reboot

Your nvidia drivers should be installed now and the displays will be working correctly

(Optional) Install NVIDIA toolkits

In case you want to run utilities like ‘nvidia-smi’ you can additionally run the following command. Before this you should obtain the current driver version, open X Server settings and take note of the first few digits of the driver version (before the decimal point)

$ sudo apt install nvidia-utils-$(3digitdriverversion)

For my installation, it was sudo apt install nvidia-utils-510