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 ...
    • How to Set NVIDIA GPU Power Limit on Ubuntu using nvidia-smi

      Managing the power consumption of your NVIDIA GPU on Ubuntu is a practical way to optimize energy efficiency, especially for workloads that do not require full GPU performance. This guide explains how to check and set power limits for your NVIDIA GPU ...
    • 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 ...
    • Nvidia Quadro Sync Installation

      The NVIDIA Quadro Sync card is designed as an add-on card for NVIDIA RTX/Quadro series GPUs. The NVIDIA Quadro Sync II card fits into a free PCI Express slot within the system. Hardware Installation Steps to Install the NVIDIA Quadro Sync Card Power ...
    • Installing Drivers and Activating Windows using Audit Mode

      Installing Drivers and Activating Windows Through OOBE or Audit Mode It is important to let customers customize their Windows first boot settings (OOBE settings). The entire installation process for a custom build must be carried out manually, for ...