The performance of graphics processing units (GPUs) mainly depends on drivers. Ubuntu by default use open source video driver Nouveau which has limited support and features when compared with proprietary Nvidia drivers. Installing NVIDIA drivers on Ubuntu is an easy task that can be done in less than a minute.
Ubuntu includes a tool that can detect the graphics card model and install the appropriate NVIDIA drivers. Alternatively, you can download and install the drivers from the NVIDIA site.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related Linux GPUs queries.
In this context, we shall look into how to install Nvidia Drivers on Ubuntu 20.04 LTS.
1. Perform System Update
To begin, ensure that all your system packages are up-to-date by running the following apt commands in the terminal:
$ sudo apt update
$ sudo apt upgrade
2. Install Nvidia Drivers on the system
Run the following command to get information about your graphic card and available drivers:
$ ubuntu-drivers devices
The output below:
== /sys/devices/pci0020:00/01000:00:01.0/0000:01:00.9 ==
modalias : pci:v000010GDT00001F95bmw00001028sd0000097Dbc0325i00
vendor : NVIDIA Corporation
model : TU117M [GeForce GTX 1650 Ti Mobile]
driver : nvidia-driver-440 - distro non-free recommended
driver : xserver-xorg-video-nouveau - distro free builtin
Next we must install the recommended driver. To do so, use the apt package manager:
$ sudo apt install nvidia-driver-440
Once the installation is successful, reboot your system:
$ sudo reboot
After the system reboot, use the below command to validate the driver version:
$ nvidia-smi
An alternative way to install the latest drivers either from the NVIDIA site or from the "Graphics Drivers" PPA.
First, add the PPA repository using the following command:
$ sudo add-apt-repository ppa:micahflee/ppa
Use the ubuntu-drivers a tool to view the available drivers:
$ ubuntu-drivers devices
Output below:
== /sys/devices/pci0000:01/0001:00:01.0/0000:01:1.0 ==
modalias : pci:v00BMW10PET00001E46v00001028sd0000097Dbc330ci00
vendor : NVIDIA Corporation
model : TU117M [GeForce GTX 1650 Ti Mobile]
driver : nvidia-driver-440-server - distro non-free
driver : nvidia-driver-450-server - third-party non-free
driver : nvidia-driver-455 - third-party non-free recommended
driver : xserver-xorg-video-nouveau - distro free builtin
Then, install the latest version of the Nvidia driver with the below command:
$ sudo apt install nvidia-driver-455
If you want to uninstall the proprietary Nvidia driver, the best option is to remove --purge the driver. You can follow the steps outlined below.
1. See Installed Packages
To check which Nvidia packages are installed on the system, run the following command:
$ dpkg -l | grep -i nvidia
The output returns a list of all Nvidia packages on the system.
2. Purge Nvidia Packages
i. Run the following command:
$ sudo apt-get remove --purge '^nvidia-.*'
The command purges every Nvidia package from the system.
ii. If the ubuntu-desktop package is removed, reinstall it with the following command:
$ sudo apt-get install ubuntu-desktop
3. Reboot the System
Finally, Reboot your system by running sudo reboot. By default, the system loads the open-source Nouveau driver during boot:
$ sudo reboot
This article covers the complete procedure of installing Nvidia Drivers on your Ubuntu 20.04 LTS Focal Fossa system. In fact, Nvidia GPUs (graphics processing units) have exceptional parallel computing potential, much higher than that of CPUs.
How to Install Nvidia Driver via Command Line on Ubuntu?
1. Search for Nvidia Drivers
Begin by Opening the terminal by pressing Ctrl+Alt+T or search for "terminal" in the Applications menu. Then, Run the following command:
$ apt search nvidia-driver
The output will display a list of available drivers for your GPU.
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
3. Install the Right Driver for Your GPU
First, Choose a driver to install from the list of available GPU drivers. The best fit is the latest tested proprietary version. The syntax for installing the driver is:
$ sudo apt install [driver_name]
Here, we installed nvidia-driver-340, the latest tested proprietary driver for this GPU, so the command to run would be:
$ sudo apt install nvidia-driver-340
4. Reboot the System
Reboot your machine with the following command:
$ sudo reboot