Ubuntu Linux Install Nvidia Driver (Latest Proprietary Driver)

I am a new Ubuntu Linux user. My laptop has Nvidia GPU. How do I install Nvidia drivers on Ubuntu Linux 16.04, 18.04, 18.10?

Introduction: Nvidia graphics processing units (GPUs) used for gaming and professional use in offices. Nvidia GPUs used in data centers, visualization, automobile industry, and artificial intelligence. By default X.org X server use nouveau free/libre software drivers for nVidia cards. The nouveau driver generally provides the inferior performance to Nvidia’s proprietary graphics device drivers for gaming and other professional use. This page shows how to install Nvidia GPU drivers on an Ubuntu Linux desktop.

Ubuntu Linux Install Nvidia Driver

The procedure to install proprietary Nvidia GPU Drivers on Ubuntu 16.04 / 17.10 / 18.04 / 18.10 / 20.04 LTS is as follows:

  1. Update your system running apt-get command
  2. You can install Nvidia drivers either using GUI or CLI method
  3. Open “Software and Updates” app to install install Nvidia driver using GUI
  4. OR type “sudo apt install nvidia-driver-455” at the CLI
  5. Reboot the computer/laptop to load the drivers
  6. Verify drivers are working

Let us see all commands in details.

Find out information about your GPU

Naturally, you can only install Nvidia driver if you have Nvidia GPU in your system. Type the hwinfo command/lshw command to find out info about your GPU:
$ hwinfo --gfxcard --short
OR
$ sudo lshw -C display
Ubuntu Linux Find Nvidia GPU info
See “Linux Find Out Graphics Card Installed In My System” for more info.

Install Nvidia driver using GUI method # 1 on Ubuntu Linux

Press the Super key (Windows key) and type the following in search box:
update manager
Ubuntu software manager to update packages
Click on the Settings button:
Ubuntu Linux Software Updater
Click on the Additional drivers tab:
Ubuntu Linux Install Nvidia Driver using Sofware Manager GUI tool
Choose nvidia-driver-460 (proprietary, tested) and click on the Apply Changes button. You must authenticate yourself to install Nvidia driver on Ubuntu Linux. You must wait for some time as Nvidia driver downloaded and installed from the internet:
Installing Nvdia drivers on Ubuntu Linux
Click on the Close button when done. You must reboot Ubuntu Linux computer to use the driver by typing the following shutdown command:
$ sudo shutdown -r now
OR
$ sudo reboot
Now skip to the driver verification step.

Ubuntu Install Nvidia driver using the CLI method # 2

Open the termial application and search for nvidia drivers using the apt command or apt-get command:
$ apt search nvidia-driver
OR use the apt-cache command to search package:
$ apt-cache search nvidia-driver
apt-get search for Nvidia driver package

Updating and installing all security and important updates on Ubuntu

Do not skip the following two commands as you must apply all pending security updates:
$ sudo apt update
$ sudo apt upgrade

Installing NVIDIA drivers on Ubuntu

Let us install the nvidia-driver-390 package:
$ sudo apt install nvidia-driver-390
At this time, the latest tested proprietary drive version is 460. We can install that one as follows on Ubuntu Linux 20.04 LTS:
$ sudo apt install nvidia-driver-460
Reboot the Linux with help of either reboot or shutdown command:
$ sudo reboot
Now go to the driver verification step.

Verification

Open the terminal application and type nvidia-smi to see GPU info and process that are using Nvidia GPU:
$ nvidia-smi
NVIDIA System Management Interface program on Ubuntu
The nvidia-smi command line utility provides monitoring and management capabilities for each of NVIDIA’s Tesla, Quadro, GRID and GeForce devices from Fermi and higher architecture families. You can see running apps on your GPU and GPU temperature.

How do I configure the NVIDIA graphics driver?

The nvidia-settings command start a GUI tool for configuring the NVIDIA graphics driver. This is useful to see all GPU info or configure multiple external screen/monitors connected to your system. Open the terminal and type the following commands:
$ nvidia-settings
If you wish to save settings start it as follows:
$ sudo nvidia-settings
Ubuntu nvidia-settings tool to configure NVIDIA graphics driver

Related: Top 7 Linux GPU Monitoring and Diagnostic Commands Line Tools

A note about ubuntu-drivers command-line method # 3

We can also change drivers without the use of the X GUI/Windows desktop. For these purposes, Ubuntu comes with a unique command called ubuntu-drivers to manage binary drivers for NVidia and other devices. This is an alternative to the apt command/apt-get command we used earlier.

Show all driver packages which apply to the current system

$ sudo ubuntu-drivers list
Outputs from my Thinkpad X1E laptop:

Display all OEM enablement packages which apply to this system

$ sudo ubuntu-drivers list-oem

View all hardware NVidia devices which need drivers, and which packages

$ sudo ubuntu-drivers devices
Here is what we see:

== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
modalias : pci:v000010DEd00001F91sv000017AAsd0000229Fbc03sc00i00
vendor   : NVIDIA Corporation
model    : TU117M [GeForce GTX 1650 Mobile / Max-Q]
driver   : nvidia-driver-440-server - distro non-free
driver   : nvidia-driver-455 - distro non-free recommended
driver   : nvidia-driver-418-server - distro non-free
driver   : nvidia-driver-450 - distro non-free
driver   : nvidia-driver-450-server - distro non-free
driver   : xserver-xorg-video-nouveau - distro free builtin

Ubuntu command to install a driver NVidia version 455

Warning: You can use only one method. If you use an earlier GUI or apt CLI method, do not try the following command. I have observed broken systems if you mixed various methods on the same system. Stick with one method.

Let us install recommended driver automatically:
sudo ubuntu-drivers install

Conclusion

You learned three different ways to install Nvidia Driver on Ubuntu 18.04 and 20.04 LTS Linux desktop or server. Unmistakably, the GUI method is simple and easy to use. The CLI method is useful for server installation, and the ubuntu-drivers command-line method is recommended for a fresh installation or OEM system like Dell XPS 13 and others. The For more info, see the official Nvidia Unix/Linux driver page online.

This entry is 1 of 2 in the Nvidia Linux and Unix Tutorial series. Keep reading the rest of the series:
  1. Ubuntu Linux Install Nvidia Driver (Latest Proprietary Driver)
  2. How to install Nvidia driver on CentOS 7 Linux


🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 14 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersncdu pydf
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
14 comments… add one
  • bull Sep 9, 2020 @ 11:17

    when you inevitably run into an error at reboot following the cli explanation at the top of this guide do the following:
    use the magic trouble shooter
    ctrl + F1 through F7
    then:
    sudo apt-get purge nvidia*
    when you’ve logged in:
    sudo ubuntu-drivers autoinstall
    autoinstall will inspect your hardware for the recommended drivers, install and set up user and group permissions.

  • Elliott Bignell Dec 2, 2020 @ 18:05

    NONE OF THIS WORKS. The options on the “Additional Drivers” tab are all greyed. None of the command line options will get past a message saying:

    “Media change: please insert the disc labeled
    “‘Ubuntu 20.10 _Groovy Gorilla_ – Release amd64 (20201022)’
    “in the drive ‘/cdrom/’ and press [Enter]”

    The machine does not have a disc drive and there is no such disk. I installed from a USB stick. How the hell do I get my second screen back? When I first installed Kubuntu a few months ago it just found the screen without effort.

    • 🐧 Vivek Gite Dec 21, 2020 @ 10:54

      You need to remove CDROM as package source. Open GUI app app “Software & Update”. Make sure you enable “Downloadable from the Internet”. Do not put CDROM. Then go to “Other Software” and disable all “CDrom with” options. Then save everything and you can now install them from the Internet. See:

      How to disable CDROM on Ubuntu

  • 9808us Jan 9, 2021 @ 14:16

    Choose nvidia-driver-390 (proprietary, tested) and click on the Apple Changes button
    I think there is no APPLE button…..

  • Zibu52 Jan 10, 2021 @ 8:48

    Just install nvidia drivers for my linux using apt command. worked perfectly on HP laptop.

    NVIDIA-SMI 460.32.03    Driver Version: 460.32.03    CUDA Version: 11.2
    

    I can’t believe it was that simple

    • MatrixGlitch Jan 15, 2021 @ 19:33

      Me too. It was very easy. I always click nixCraft tutorial. I am visiting this site since last 10 years or more.

  • Enrique Jan 12, 2021 @ 12:08

    I have an error after installing drivers with the second method (CLI).
    My NVIDIA graphic card is a GeForce GT 630, and I have installed the following driver: nvidia-driver-460

    When I try to do the verification step, I receive the following error;
    egonzalez@pc-despacho:~$ nvidia-smi
    NVIDIA-SMI has failed because it couldn’t communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

    i do not know how to solve this :(

    • 🐧 Vivek Gite Jan 12, 2021 @ 14:15

      Reboot the system to load and get updated NVIDIA driver.

      • James Bowery Feb 28, 2021 @ 4:39

        Rebooting didn’t resolve the error:

        “NVIDIA-SMI has failed because it couldn’t communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.”

        Changing the driver versions (multiple versions multiple times) and rebooting every time didn’t resolve it.

  • Slayer Jan 14, 2021 @ 10:24

    Bull. You saved my ass. Worked a treat.

  • jaynux Jan 19, 2021 @ 7:09

    This post is really awesome. You save my time. I have trouble installing the 3090 driver. However, I solved my problem by following your post. Thank you so much!!

    • Manoj Batija Mar 3, 2021 @ 18:56

      I agree. +1 for providing upto date information for developer like me who just started with Ubuntu Linux. Worked perfectly on my Dell XPS 15 laptop.

  • Ivar Mar 22, 2021 @ 8:49

    Thank you very much. It works fine :b

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum