How To Install Nvidia Drivers On Ubuntu 20.04 / Ubuntu 18.04 | Holhol24

137

All Desktops and Laptops come with a graphics card for displaying images over a monitor. Graphics cards either come with a system board or attached to the system board via a PCI-E slot. Nvidia and AMD manufactured graphics cards are the most commonly used graphics cards in laptops or desktops.

Here, we will see how to install Nvidia drivers on Ubuntu 20.04/Ubuntu 18.04.

Find Graphics Card Information

Let us find the graphics card attached to your system. Use the lshw command to find it.

sudo lshw -C display
Graphic Card Information

From the above output, you can see that the system has an Nvidia graphics card and it uses Nouveau drivers. Nouveau is an open-source display driver for Nvidia cards and it is developed through reverse engineering of the Nvidia driver.

Install Nvidia Driver

We can install the Nvidia drivers in multiple ways and from different sources.

1. Graphical Installation

2. Install Nvidia drivers from Ubuntu repository

i. ubuntu-drivers command

ii. apt command

3. Install Nvidia drivers from PPA

4. Install Nvidia drivers from Official site

1. Graphical Install

Go to Activities >> Software & Updates >> Additional Drivers.

This tab will display the available driver versions for your graphic card. Choose the suitable driver version you want to install or the recommended one (top of the list) and then click Apply Changes.

Choose The Driver Version How To Install Nvidia Drivers On Ubuntu 20.04 / Ubuntu 18.04 | Holhol24 How To Install Nvidia Drivers On Ubuntu 20.04 / Ubuntu 18.04 | Holhol24 1605830106 519 How To Install Nvidia Drivers On Ubuntu 2004 Ubuntu
Choose The Driver Version

Enter the password to authenticate the driver installation. Then, wait for the installation to complete.

If your Ubuntu system has UEFI secure boot enabled, you may need to configure secure boot and enroll the MOK key in your system’s firmware.

Reboot the system post the installation and then validate the driver installation by going again to the Additional Drivers tab.

Validate Driver Version How To Install Nvidia Drivers On Ubuntu 20.04 / Ubuntu 18.04 | Holhol24 How To Install Nvidia Drivers On Ubuntu 20.04 / Ubuntu 18.04 | Holhol24 1605830106 466 How To Install Nvidia Drivers On Ubuntu 2004 Ubuntu
Validate Driver Version

2. Install Nvidia driver from Ubuntu repository

i. ubuntu-drivers command

First, update the repository index to refresh the available Nvidia drivers.

sudo apt update

Then, list the available driver versions for your graphic card.

sudo ubuntu-drivers devices
Available Driver Versions How To Install Nvidia Drivers On Ubuntu 20.04 / Ubuntu 18.04 | Holhol24 How To Install Nvidia Drivers On Ubuntu 20.04 / Ubuntu 18.04 | Holhol24 1605830106 401 How To Install Nvidia Drivers On Ubuntu 2004 Ubuntu
Available Driver Versions

Finally, use the ubuntu-drivers command to install the recommended Nvidia driver package.

sudo ubuntu-drivers install

If your Ubuntu system has UEFI secure boot enabled, you may need to configure secure boot and enroll the MOK key in your system’s firmware.

After the installation, reboot the system.

sudo reboot

After the system reboot, use the below command to validate the driver version.

sudo nvidia-smi
Validate Nvidia Driver Version How To Install Nvidia Drivers On Ubuntu 20.04 / Ubuntu 18.04 | Holhol24 How To Install Nvidia Drivers On Ubuntu 20.04 / Ubuntu 18.04 | Holhol24 1605830107 969 How To Install Nvidia Drivers On Ubuntu 2004 Ubuntu
Validate Nvidia Driver Version

ii. apt command

First, update the repository index to refresh the available Nvidia drivers.

sudo apt update

Then, list the available driver packages for your Nvidia graphic card.

sudo apt list nvidia-driver-*
Available Nvidia Driver Versions How To Install Nvidia Drivers On Ubuntu 20.04 / Ubuntu 18.04 | Holhol24 How To Install Nvidia Drivers On Ubuntu 20.04 / Ubuntu 18.04 | Holhol24 1605830107 6 How To Install Nvidia Drivers On Ubuntu 2004 Ubuntu
Available Nvidia Driver Versions

Finally, install the driver version you want. Here, I will install the latest version available from the Ubuntu repository which is v440.100.

sudo apt install -y nvidia-driver-440-server

If your Ubuntu system has UEFI secure boot enabled, you may need to configure secure boot and enroll the MOK key in your system’s firmware.

Reboot the system post installing the driver package.

sudo reboot

After the system reboot, use the below command to validate the driver version.

sudo nvidia-smi
Validate Nvidia Driver Version How To Install Nvidia Drivers On Ubuntu 20.04 / Ubuntu 18.04 | Holhol24 How To Install Nvidia Drivers On Ubuntu 20.04 / Ubuntu 18.04 | Holhol24 1605830107 365 How To Install Nvidia Drivers On Ubuntu 2004 Ubuntu
Validate Nvidia Driver Version

3. Install Nvidia Driver From PPA

Nvidia proprietary GPU drivers are available in Launchpad. It has the latest drivers from upstream, currently shipping Nvidia.

This PPA is currently in testing. Please use it with caution.

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

sudo apt update

List the available driver packages for your graphic card.

sudo apt list nvidia-driver-*

OR

sudo ubuntu-drivers devices

Install the latest version of the Nvidia driver with the below command.

sudo apt install -y nvidia-driver-450

OR

sudo ubuntu-drivers install

If your Ubuntu system has UEFI secure boot enabled, you may need to configure secure boot and enroll the MOK key in your system’s firmware.

Reboot the system post installing the driver package.

sudo reboot

After the system reboot, use the below command to validate the driver version.

sudo nvidia-smi
Validate Nvidia Driver Version How To Install Nvidia Drivers On Ubuntu 20.04 / Ubuntu 18.04 | Holhol24 How To Install Nvidia Drivers On Ubuntu 20.04 / Ubuntu 18.04 | Holhol24 1605830107 708 How To Install Nvidia Drivers On Ubuntu 2004 Ubuntu
Validate Nvidia Driver Version

4. Install Official Nvidia Driver

Nvidia recommends using the installation method provided by Ubuntu or the operating system vendor for installing Nvidia drivers instead of using the Nvidia installer.

First, disable Nouveau drivers in case your system uses it.

echo "blacklist nouveau" | sudo tee /etc/modprobe.d/disable-nouveau.conf

echo "options nouveau modeset=0" | sudo tee -a /etc/modprobe.d/disable-nouveau.conf

Reboot the system

sudo reboot

Add 32-bit architecture on to your machine to install 32-bit libraries for Nvidia drivers.

sudo dpkg --add-architecture i386 

sudo apt update

Install the required libraries.

sudo apt install -y libc6:i386 gcc autoconf make libglvnd-dev

Download the latest driver package from the Nvidia website.

OR

Use the below command to download the latest version v450.66 using the terminal.

wget https://us.download.nvidia.com/XFree86/Linux-x86_64/450.66/NVIDIA-Linux-x86_64-450.66.run

Install the Nvidia driver using the below command.

Legacy BIOS System

sudo sh NVIDIA-Linux-x86_64-450.66.run

Follow the on-screen instruction to install the Nvidia driver.

Continue Installation – To install Nvidia driver using the Nvidia installer

Yes – To install Nvidia’s 32-bit compatible libraries

Yes – To update nvidia-xconfig utility to automatically update x configuration file so that the Nvidia driver will be used when restarting X.

UEFI System

Before you run the below command, generate a Machine-owner key, and enroll it in your system’s firmware.

sudo sh ./NVIDIA-Linux-x86_64-450.66.run -s --module-signing-secret-key=/var/tmp/MOK.priv --module-signing-public-key=/var/tmp/MOK.pem

Reboot the system post installing the driver package.

sudo reboot

After the system reboot, use the below command to validate the driver version.

sudo nvidia-smi
Validate Nvidia Driver Version How To Install Nvidia Drivers On Ubuntu 20.04 / Ubuntu 18.04 | Holhol24 How To Install Nvidia Drivers On Ubuntu 20.04 / Ubuntu 18.04 | Holhol24 1605830107 633 How To Install Nvidia Drivers On Ubuntu 2004 Ubuntu
Validate Nvidia Driver Version

UEFI System – SecureBoot Enabled

Install Nvidia Drivers from Ubuntu Repository / PPA

If you have an Ubuntu system with UEFI secure boot enabled, during the Nvidia driver installation (using graphical method or apt command or ubuntu-drivers command or from PPA), the system will ask you to set a password (If not already set during the OS installation (Third-party software) or MOK (Machine-Owner key) is not enrolled after the OS installation) and that can be used to enroll MOK in your system’s firmware.

Select OK on configuring secure boot wizard.

Configure Secure Boot How To Install Nvidia Drivers On Ubuntu 20.04 / Ubuntu 18.04 | Holhol24 How To Install Nvidia Drivers On Ubuntu 20.04 / Ubuntu 18.04 | Holhol24 1605830107 57 How To Install Nvidia Drivers On Ubuntu 2004 Ubuntu
Configure Secure Boot

Enter a password for secure boot.

"<yoastmark How To Install Nvidia Drivers On Ubuntu 20.04 / Ubuntu 18.04 | Holhol24 How To Install Nvidia Drivers On Ubuntu 20.04 / Ubuntu 18.04 | Holhol24 Enter Password

Enter the same password again to confirm the password.

"Re-<yoastmark How To Install Nvidia Drivers On Ubuntu 20.04 / Ubuntu 18.04 | Holhol24 How To Install Nvidia Drivers On Ubuntu 20.04 / Ubuntu 18.04 | Holhol24 Re Enter Password

Reboot the system and then enroll MOK.

sudo reboot

Install Official Nvidia Drivers

First, check if your system has secure boot enabled.

sudo mokutil --sb-state

Output:

SecureBoot enabled

Generate and import the MOK.

sudo openssl req -new -x509 -newkey rsa:2048 -keyout /var/tmp/MOK.priv -outform DER -out /var/tmp/MOK.der -days 36500 -subj "/CN=ubuntu/" -nodes

sudo mokutil --import /var/tmp/MOK.der

Convert .der file in to .pem format for Nvidia driver installation.

openssl x509 -in /var/tmp/MOK.der -inform DER -outform PEM -out /var/tmp/MOK.pem

Reboot the system and then enroll MOK.

sudo reboot

Enroll Machine-Owner Key

Upon system reboot, you will need to perform MOK management.

Choose Enroll MOK » Continue » Yes » Enter Password (you have set earlier) » Reboot.

After the system reboot, validate the driver version on your Ubuntu system.

sudo nvidia-smi
Validate Nvidia Driver Version How To Install Nvidia Drivers On Ubuntu 20.04 / Ubuntu 18.04 | Holhol24 How To Install Nvidia Drivers On Ubuntu 20.04 / Ubuntu 18.04 | Holhol24 1605830107 365 How To Install Nvidia Drivers On Ubuntu 2004 Ubuntu
Validate Nvidia Driver Version

Manage Nvidia Settings

You can manage the Nvidia drivers settings by going to Activities >> Search for Nvidia X Server Settings.

OR

sudo nvidia-settings
Nvidia Settings How To Install Nvidia Drivers On Ubuntu 20.04 / Ubuntu 18.04 | Holhol24 How To Install Nvidia Drivers On Ubuntu 20.04 / Ubuntu 18.04 | Holhol24 1605830108 675 How To Install Nvidia Drivers On Ubuntu 2004 Ubuntu
Nvidia Settings

Conclusion

That’s All. Please share your feedback in the comments section.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More