How to Install Nvidia Drivers on Ubuntu 20.04

March 23, 2021


Nvidia GPUs (graphics processing units) have exceptional parallel computing potential, much higher than that of CPUs. That is why GPUs are becoming the main choice for high-performance workloads.

Aside from gaming, Nvidia GPUs are also used for 3D rendering, mining, visualization, machine learning, AI, and in data centers.

In this tutorial, you will learn how to install the latest proprietary Nvidia drivers on Ubuntu 20.04.

How to install Nvidia drivers on Ubuntu 20.04


  • A machine running Ubuntu 20.04
  • An account with sudo/root permissions
  • An Nvidia GPU

Note: Learn why and how GPUs are used for machine learning and AI in our article on GPU Machine Learning.

Install Nvidia Driver Using GUI

Ubuntu comes with open-source Nouveau drivers for Nvidia GPUs out of the box. The Nouveau driver does not harness the GPU’s full power and sometimes performs worse or even causes system instability. Nvidia proprietary drivers are much more reliable and stable.

The first way to install Nvidia drivers is by using the GUI Software & Updates app.

Step 1: Open Software and Updates From the App Menu

1. Open the Applications menu and type “software and updates.”

2. Select the Software and Updates app.

Step 2: Click the Additional Drivers Tab

Wait for the app to download a list of additional drivers available for your GPU.

Install proprietary Nvidia drivers via a GUI app.

The driver installed on your machine is selected by default. It is usually an open-source Nouveau display driver.

Step 3: Choose a Driver

1. From the list, select the latest Nvidia driver labeled proprietary, tested. This is the latest stable driver published by Nvidia for your GPU.

Choose a proprietary Nvidia driver to install on Ubuntu 20.04

2. Click Apply Changes.

3. Enter your password and wait for the installation to finish.

Step 4: Restart

Restart the machine for the changes to take effect.

Install Nvidia Driver via Command Line

The second way to install Nvidia drivers is by using the terminal.

Step 1: Search for Nvidia Drivers

1. Open the terminal by pressing Ctrl+Alt+T or search for “terminal” in the Applications menu.

2. Run the following command:

apt search nvidia-driver
Search for available Nvidia drivers using the terminal in Ubuntu 20.04.

The output shows a list of available drivers for your GPU.

Step 2: Update the System Package Repository

Before installing the driver, make sure to update the package repository. Run the following commands:

sudo apt update
sudo apt upgrade

Step 3: Install the Right Driver for Your GPU

1. Choose a driver to install from the list of available GPU drivers. The best fit is the latest tested proprietary version.

2. The syntax for installing the driver is:

sudo apt install [driver_name]
Install Nvidia drivers by using the terminal in Ubuntu 20.04

For this tutorial, we installed nvidia-driver-340, the latest tested proprietary driver for this GPU.

Step 4: Reboot

Reboot your machine with the following command:

sudo reboot

Install Nvidia Beta Drivers via PPA Repository

The PPA repository allows developers to distribute software that is not available in the official Ubuntu repositories. This means that you can install the latest beta drivers, however, at the risk of an unstable system.

To install the latest Nvidia drivers via the PPA repository, follow these steps:

Step 1: Add PPA GPU Drivers Repository to the System

1. Add the graphics drivers repository to the system with the following command:

sudo add-apt-repository ppa:graphics-drivers/ppa
Add the GPU PPA repository to Ubuntu 20.04.

2. Enter your password and hit Enter when asked if you want to add the repository.

Step 2: Identify GPU Model and Available Drivers

To verify which GPU model you are using and to see a list of available drivers, run the following command:

ubuntu-drivers devices
Identify GPU and available Nvidia drivers in Ubuntu 20.04.

The output shows your GPU model as well as any available drivers for that specific GPU.

Step 3: Install Nvidia Driver

1. To install a specific driver, use the following syntax:

sudo apt install [driver_name]
Install Nvidia drivers by using the terminal in Ubuntu 20.04

For example, we installed the nvidia-340 driver version.

2. Alternatively, install the recommended driver automatically by running:

sudo ubuntu-drivers autoinstall
Install the recommended Nvidia driver automatically in Ubuntu 20.04.

In this example, no changes were made as the recommended driver is already installed.

Step 4: Restart the System

Reboot the machine for the changes to take effect.

How to Uninstall Nvidia Driver

If you want to uninstall the proprietary Nvidia driver, the best option is to remove --purge the driver.

Step 1: See Installed Packages

To check which Nvidia packages are installed on the system, run the following command:

dpkg -l | grep -i nvidia
See installed Nvidia packages on Ubuntu 20.04.

The output returns a list of all Nvidia packages on the system.

See also our article on how to list installed packages on Ubuntu.

Note: The ubuntu-desktop package could also be purged because it is a dependency of the nvidia-common package, so you may need to reinstall it if it gets removed.

Step 2: Purge Nvidia Packages

1. Run the following command:

sudo apt-get remove --purge '^nvidia-.*'
Remove all Nvidia packages from Ubuntu 20.04.

The command purges every Nvidia package from the system.

2. If the ubuntu-desktop package is removed, reinstall it with the following command:

sudo apt-get install ubuntu-desktop

Step 4: Reboot the System

Reboot your system by running sudo reboot. By default, the system loads the open-source Nouveau driver during boot.


You now know how to install proprietary Nvidia drivers on your system using the GUI app, official Ubuntu repository, or the PPA repository if you want the beta versions.

You also know how to uninstall Nvidia drivers if you want to go back to using the open-source Nouveau driver.

Was this article helpful?
Bosko Marijan
Having worked as an educator and content writer, combined with his lifelong passion for all things high-tech, Bosko strives to simplify intricate concepts and make them user-friendly. That has led him to technical writing at PhoenixNAP, where he continues his mission of spreading knowledge.
Next you should read
How to Install Puppet on Ubuntu 20.04
January 25, 2024

Puppet is an open-source solution that helps you perform administrative tasks remotely. This tutorial takes...
Read more
How to Install KVM on Ubuntu 20.04
December 3, 2020

KVM (short for Kernel-based Virtual Machine) is a Linux kernel module which enables creating and running...
Read more
How to Install and Configure Nginx on Ubuntu 20.04
October 1, 2020

Nginx is an open-source application used for managing web servers, load balancing, and security. This...
Read more
How to Install NVIDIA Tesla Drivers on Linux or Windows
September 7, 2018

Growing demands for extreme compute power lead to the unavoidable presence of bare metal servers in today's...
Read more