How to install the NVIDIA drivers on Ubuntu 22.04

The objective is to install the NVIDIA drivers on Ubuntu 22.04 (Jammy Jellyfish) Linux and switch from a default opensource Nouveau driver to the proprietary Nvidia driver.

To install Nvidia driver on other Linux distributions, follow our Nvidia Linux Driver guide.

In this tutorial you will learn:

  • Perform an automatic Nvidia driver installation using standard Ubuntu Repository
  • Learn how to perform an Nvidia driver installation using PPA repository
  • How to install the official Nvidia.com driver
  • Uninstall/switch back from Nvidia to Nouveau opensource driver
How to install the NVIDIA drivers on Ubuntu 22.04

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Installed or upgraded Ubuntu 22.04 Jammy Jellyfish
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to install Nvidia Drivers using a standard Ubuntu Repository step by step instructions

The first method is the easiest to perform and in most cases it is the recommended approach.

GNOME GUI Nvidia Installation Method

Open the Software & Updates application window. Select TAB Additional Drivers and choose any proprietary NVIDIA driver. The higher the driver number the latest the version.

Command Line Nvidia Installation Method

  1. First, detect the model of your nvidia graphic card and the recommended driver. To do so execute the following command. Please note that your output and recommended driver will most likely be different:
    $ ubuntu-drivers devices
    == /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
    modalias : pci:v000010DEd00002206sv00001458sd0000403Fbc03sc00i00
    vendor : NVIDIA Corporation
    model : GA102 [GeForce RTX 3080]
    driver : nvidia-driver-470 - distro non-free recommended
    driver : nvidia-driver-470-server - distro non-free
    driver : nvidia-driver-495 - distro non-free
    driver : nvidia-driver-460-server - distro non-free
    driver : xserver-xorg-video-nouveau - distro free builtin
    
    


    From the above output we can conclude that the current system has NVIDIA GeForce RTX 3080 graphic card installed and the recommend driver to install is nvidia-driver-470.

  2. Install driver.If you agree with the recommendation feel free to use the ubuntu-drivers command again to install all recommended drivers:
    $ sudo ubuntu-drivers autoinstall
    

    Alternatively, install desired driver selectively using the apt command. For example:

    $ sudo apt install nvidia-driver-470
    
  3. Once the installation is concluded, reboot your system and you are done.
    $ sudo reboot
    

Automatic Install using PPA repository to install Nvidia Beta drivers

  1. Using graphics-drivers PPA repository allows us to install bleeding edge Nvidia beta drivers at the risk of an unstable system. To proceed first add the ppa:graphics-drivers/ppa repository into your system:
    $ sudo add-apt-repository ppa:graphics-drivers/ppa
    
  2. Next, identify your graphic card model and recommended driver:
    ubuntu-drivers devices
    == /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
    modalias : pci:v000010DEd00002206sv00001458sd0000403Fbc03sc00i00
    vendor : NVIDIA Corporation
    model : GA102 [GeForce RTX 3080]
    driver : nvidia-driver-470 - third-party non-free recommended
    driver : nvidia-driver-460-server - distro non-free
    driver : nvidia-driver-470-server - distro non-free
    driver : nvidia-driver-495 - distro non-free
    driver : xserver-xorg-video-nouveau - distro free builtin
    
  3. Install Nvidia DriverSame as with the above standard Ubuntu repository example, either install all recommended drivers automatically:
    $ sudo ubuntu-drivers autoinstall
    

    or selectively using the apt command. Example:

    $ sudo apt install nvidia-driver-470
    
  4. All done.Reboot your computer:
    $ sudo reboot
    


Manual Install using the Official Nvidia.com driver step by step instructions

  1. identify your NVIDIA VGA card.The below commands will allow you to identify your Nvidia card model:
    $  lshw -numeric -C display
    or
    $ lspci -vnn | grep VGA
    or
    $ ubuntu-drivers devices
    
  2. Download the Official Nvidia Driver.Using your web browser navigate to the official Nvidia website and download an appropriate driver for your Nvidia graphic card.Alternatively, if you know what you are doing you can download the driver directly from the Nvidia Linux driver list. Once ready you should end up with a file similar to the one shown below:
    $ ls
    NVIDIA-Linux-x86_64-470.94.run
    
  3. Install PrerequisitesThe following prerequisites are required to compile and install Nvidia driver:
    $ sudo apt install build-essential libglvnd-dev pkg-config
    


  1. Disable Nouveau Nvidia driver.Next step is to disable the default nouveau Nvidia driver. Follow this guide on how to disable the default Nouveau Nvidia driver.
    WARNING
    Depending on your Nvidia VGA model your system might misbehave. At this stage be ready to get your hands dirty. After the reboot you may end up without GUI at all. Be sure that you have the SSH enabled on your system to be able login remotely or use CTRL+ALT+F2 to switch TTY console and continue with the installation.

    Make sure you reboot your system before you proceed to the next step.

  2. Stop Desktop Manager.In order to install new Nvidia driver we need to stop the current display server. The easiest way to do this is to change into runlevel 3 using the telinit command. After executing the following linux command the display server will stop, therefore make sure you save all your current work ( if any ) before you proceed:
    $ sudo telinit 3
    

    Hit CTRL+ALT+F1 and login with your username and password to open a new TTY1 session or login via SSH.

  3. Install Nvidia Driver.To start installation of Nvidia driver execute the following linux command and follow the wizard:
    $ sudo bash NVIDIA-Linux-x86_64-470.94.run
    
  4. The Nvidia driver is now installed.Reboot your system:
    $ sudo reboot
    
  5. Configure NVIDIA X Server Settings.After reboot your should be able to start NVIDIA X Server Settings app from the Activities menu.

How to Uninstall Nvidia Driver

Follow our guide on how to uninstall Nvidia Driver hence switch back from Nvidia to Nouveau opensource driver.



Comments and Discussions