Bought a new computer or installed the Nvidia graphics card on your existing computer but didn’t find the Nvidia drivers installed on Ubuntu. It is because, by default, Ubuntu comes preinstalled with the Nouveau drivers for Nvidia graphics cards. However, Nvidia drivers can be installed manually. Installing Nvidia drivers on Ubuntu will also install the Nvidia drivers manager which lets you control the drivers.

This article will go through various methods to install the Nvidia drivers on Ubuntu 24.04.

How to Install Nvidia Drivers on Ubuntu 24.04

As we learned, Nvidia drivers do not come preinstalled on Ubuntu. Nvidia drivers can be installed from the official Ubuntu repository, through the PPA repository, and GUI. Check out these methods to install Nvidia drivers on Ubuntu 24.04:

Method 1: Install Nvidia Drivers on Ubuntu Linux using GUI

The most straightforward way to install Nvidia drivers on Ubuntu is through the “Software & Update” or “Additional Drivers” application. Check the following steps to install the Nvidia drivers on Ubuntu through GUI.

1. Open Software & Updates from the applications menu.

2. Navigate to the Additional Drivers section.

3. Check the Nvidia drivers and click on the Apply changes to install the Nvidia drivers on Ubuntu.

4. Once the Nvidia drivers are installed, reboot the system to apply the changes:

Method 2: Install Nvidia Drivers on Ubuntu using apt Command

You can install the Nvidia drivers on Ubuntu through the official apt repository. For that, you need to search for the available Nvidia drivers and then install the desired driver manually. Follow the instructions given below to install the Nvidia drivers on Ubuntu.

Step 1: Update Ubuntu Repositories

Before installing Nvidia drivers from the official repository it is recommended to update the local repositories. To do so, first, press CTRL + Alt + T shortcut key to open the Terminal, and run the given command:

sudo apt update && sudo apt upgrade -y

Step 2: Search for the Nvidia Drivers in the Official Repository

Once the Ubuntu packages are updated, then, search for the suitable Nvidia drivers for your system in Ubuntu’s official repository by running this command:

sudo apt search nvidia-driver

Step 3: Install the Suitable Nvidia Driver

After selecting the suitable Nvidia driver package, specify it to the apt install command with sudo privileges to install that Nvidia driver on Ubuntu, as shown below:

sudo apt install nvidia-driver-535

Remember: To install the Nvidia driver of your choice simply replace it with the nvidia-driver-535 driver in the above script:

Step 4: Reboot the System

Once the Nvidia driver is installed on Ubuntu, reboot the system by running the below command to apply the changes:

sudo reboot

Method 3: Install Nvidia Drivers on Ubuntu using the Command Line

Alongside installing the Nvidia drivers manually on Ubuntu, you can also install the suitable Nvidia driver for your system automatically. Check the stepwise instructions given below to install the Nvidia drivers automatically on Ubuntu 24.04.

Step 1: Get the List of Recommended Drivers

First, check the Nvidia graphic card installed on your system and get the recommended Nvidia drivers accordingly by running this command:

sudo ubuntu-drivers devices

Step 2: Install the Nvidia Drivers on Ubuntu

Once you identified the recommended Nvidia driver for your Ubuntu system. Then, you can install that driver version manually or automatically. 

To install the suitable Nvidia driver for your Ubuntu system, run this command:

sudo apt install {recommended driver name}

Remember: Replace the recommended driver for your computer with the above driver.

Alternatively, you can install the recommended driver automatically by running the command given below:

sudo ubuntu-drivers autoinstall

This command will find and install the suitable Nvidia driver on Ubuntu:

Step 3: Restart the System

After installing the Nvidia driver on Ubuntu, reboot the system to apply changes by running this command:

sudo reboot

Method 4: Install Nvidia Drivers on Ubuntu using the PPA Repository (Latest)

You can also install the Nvidia drivers on Ubuntu through the PPA repository of graphics-drivers. This PPA repository will keep your Nvidia drivers up to date and will install the latest version of it. However, the latest Nvidia driver may risk your system to an unstable state. Check the following steps to install the Nvidia drivers using the PPA repository.

Step 1: Add the Graphics Driver Repository

First, add the graphics-drivers PPA repository to the Ubuntu system, by running this command:

sudo add-apt-repository ppa:graphics-drivers/ppa

Step 2: Get the List of Recommended Drivers

Once the PPA repository is added to the system, run this command to get the recommended Nvidia drivers according to your Nvidia graphics card:

sudo ubuntu-drivers devices

By default, the above command gets the recommended Nvidia drivers from the official Ubuntu repository. However, after the addition of the PPA repository to the system, this command will retrieve the list of recommended drivers from that added repository directly:

Step 3: Install the Nvidia Drivers on Ubuntu

Once you get the recommended driver from the above command, then install the driver by specifying it to the apt install command with sudo privileges as shown below:

sudo apt install {recommended driver name}

Or you can install the latest Nvidia driver from the PPA repository automatically by running this command:

sudo ubuntu-drivers autoinstall

Step 4: Restart the System

Once the Nvidia gets installed, then, reboot the system by running the below to apply the changes to the system:

sudo reboot

How to Uninstall Nvidia Drivers from Ubuntu 24.04

Once you are done with using the Nvidia drivers or want to remove them for any other reason, check the following instructions to remove them from Ubuntu.

Step 1: List Installed Nvidia Drivers

Before removing the Nvidia drivers, check if the Nvidia are installed on Ubuntu by running this command:

dpkg -l | grep -i nvidia

The above command will select all the installed Nvidia drivers on Ubuntu:

Step 2: Remove Nvidia Drivers

Once you identified the installed Nvidia drivers, run this command to remove all the Nvidia drivers from Ubuntu:

sudo apt remove --purge '^nvidia-.*' -y

This command will select all the Nvidia drivers and remove them from Ubuntu:

Note: In most cases, users on the internet reported that removing the Nvidia drivers resulted in removing the Ubuntu desktop environment. If that happens to you, then run this command to install the Ubuntu desktop environment:

sudo apt install ubuntu-desktop

Step 3: Reboot the System

After removing the Nvidia drivers from Ubuntu, reboot the system to apply the changes by running this command:

sudo reboot

Conclusion

To install Nvidia drivers on Ubuntu, open Terminal first and run the ubuntu-drivers devices command to get the recommended Nvidia drivers for your system. Then, specify the recommended Nvidia driver to the apt install command to install it manually. Or to automatically install the recommended Nvidia driver run the sudo apt auto-install command. Alternatively, you can install Nvidia drivers on Ubuntu by adding a PPA repository that installs the latest driver. To remove the Nvidia driver from Ubuntu run the sudo apt remove –purge ‘^nvidia-.*’ command.