Installing NVIDIA Drivers on Ubuntu

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

    • Related Articles

    • How to Remove and Reinstall NVIDIA Drivers on Ubuntu

      This article provides step by step guide to completely remove existing NVIDIA drivers and reinstall specific version of the NVIDIA driver on the Ubuntu system Prerequisites Administrative (sudo) access to the Ubuntu system. Internet access to ...
    • Backup, Snapshot, and Restore Linux installations using Timeshift

      If you mess up (or are going to mess up) some config files or drivers, it is always good to have a fallback point. The de-facto standard for doing this on Linux is Timeshift. Timeshift for Linux is an application that provides functionality similar ...
    • Setup noVNC on Ubuntu 20.04/Gnome 3.36

      VNC (Virtual Network Computing) enables you to control your Linux installation from another computer on the same network, by viewing and interacting with the desktop from the other computer. To learn more about VNC, click here noVNC allows you to ...
    • Enable Root Login in GUI Lock Screen in Ubuntu.

      How to Enable Root Login in Ubuntu in Login Screen. Do you have Trouble to Login as root user in Ubuntu like this? Steps to Enable Root Login Login as other user as you Define in Installation time. Open the Terminal, shortcut to open Terminal ...
    • Configuration to Enable ssh(Remote) Login in Ubuntu.

      How to Enable ssh (Remote) Login in Ubuntu. Have a Trouble to Access ssh Login in Ubuntu. Steps to Configure ssh configuration file. Go to your system/VM and Open Terminal (use ctl+atl+t) and Follow Commands. Open sshd_config file in any editor like ...