NVIDIA GPUs are required even on screenless Ubuntu servers (no graphical user interface installed) to encode/decode the media files, run the artificial intelligence codes, run the CUDA programs, and more.
In this article, we will show you how to install the official NVIDIA GPU drivers on a Ubuntu Server 22.04 LTS headless computer.
Theme content:
- Connect to the Ubuntu Server 22.04 LTS via SSH
- Verify that the NVIDIA GPU is installed
- Updating the APT package repository cache
- Available NVIDIA drivers for Headless Ubuntu Server 22.04 LTS
- Installing the latest version of NVIDIA drivers on Ubuntu Server 22.04 LTS
- Verify that the NVIDIA drivers are installed correctly
- Diploma
- references
Connecting to the Ubuntu Server 22.04 LTS machine via SSH
Connecting to your Ubuntu Server 22.04 LTS machine via SSH is optional if you have access to the server hardware (on which you installed Ubuntu Server 22.04 LTS). You can simply connect a mouse, keyboard and monitor to the server and install the NVIDIA drivers on them.
If you do not have access to the Ubuntu Server 22.04 LTS server hardware, you will need to establish an SSH connection to install the NVIDIA drivers.
To SSH into your Ubuntu Server 22.04 LTS machine, you can run the following command from a terminal app of your desktop/laptop from which you want to access the Ubuntu Server 22.04 LTS machine:
Make sure you
If you’re using Windows 10 or Windows 11 and need help connecting to your Ubuntu Server 22.04 LTS machine via SSH, keep reading the article How to SSH into the Linux servers from Windows 10/11.
Verify that the NVIDIA GPU is installed
Run the following command to verify if you have an NVIDIA GPU installed on your Ubuntu server machine:
As you can see, we installed an NVIDIA GeForce 1050 Ti GPU on our Ubuntu server machine.
You can also see from the output of the following commands that the open source Nouveau drivers are being used instead of the official NVIDIA GPU drivers. In the next sections, we will show you how to install the official NVIDIA GPU drivers on your Ubuntu server.
$lsmod | grep nouveau
Updating the APT package repository cache
Before you can install the official NVIDIA drivers on the Ubuntu servers, you should update the APT package repository cache with the following command:
The APT package repository cache should be updated.
Available NVIDIA drivers for Headless Ubuntu Server 22.04 LTS
You can install either of the two official NVIDIA driver packages on a Headless Ubuntu Server 22.04 LTS:
- nvidia-driver-[version]-Server – Install this NVIDIA driver package if you want to install official NVIDIA drivers on your Ubuntu Server 22.04 LTS Headless computer, including all recommended packages and NVIDIA tools.
- nvidia-headless-[version]-Server – Install this NVIDIA driver package if you want to install only required official NVIDIA driver components and omit all recommended packages and NVIDIA tools to keep your Ubuntu server as light as possible.
If you choose to install the nvidia headless[version]-server package to install the official NVIDIA drivers on your Ubuntu server, you may also want to install one or both of the NVIDIA packages:
- nvidia-utils-[version]-Server – Install this package if you need to run the nvidia-smi command to monitor GPU usage on your Ubuntu server.
- libnvidia-encode-[version]-Server – Install this package if you want to encode and decode the media on your Ubuntu server using NVENC or NVDEC capabilities of your NVIDIA GPU.
Here is
You can see the available versions of the nvidia-driver-package
You can check the available versions of the nvidia-headless-package
You can find the available versions of the package nvidia-utils-
You can check the available versions of the libnvidia-encode-
Installing the latest version of NVIDIA drivers on Ubuntu Server 22.04 LTS
Run the following command to install the official NVIDIA drivers including all recommended NVIDIA tool packages on your headless Ubuntu Server 22.04 LTS machine:
Run the following command to install the minimal version of the official NVIDIA drivers and NVIDIA driver utilities on your headless Ubuntu Server 22.04 LTS machine:
Run the following command to install the minimal version of the official NVIDIA drivers, the NVIDIA driver utilities, and the NVIDIA NVENC encoder and NVDEC decoder libraries on your headless Ubuntu Server 22.04 LTS machine:
To confirm the installation, press Y and then press
The NVIDIA driver packages and the required dependency packages will be downloaded. It takes a while to finish.
The NVIDIA driver packages and required dependency packages will be installed. It takes a while to finish.
Once you see the prompts, press
The NVIDIA drivers should be installed on your Headless Ubuntu Server 22.04 LTS machine.
For the changes to take effect, restart your Ubuntu server with the following command:
Verify that the NVIDIA drivers are installed correctly
Once your Ubuntu server is up and running, you can use the following commands to verify that the NVIDIA kernel modules are being used instead of the open-source Nouveau kernel modules. So the official NVIDIA GPU drivers work fine:
$lsmod | grep nvidia
You can also find your NVIDIA GPU usage information with the nvidia-smi command. The output of this command also verifies that your NVIDIA GPU drivers are installed correctly.
Diploma
We showed you how to check if you have an NVIDIA GPU installed on your Ubuntu Server 22.04 LTS machine. We also showed you how to install official NVIDIA GPU drivers on Ubuntu Server 22.04 LTS in headless mode (no GUI installed) and how to check if official NVIDIA GPU drivers are installed on Ubuntu Server 22.04 LTS work.