NVIDIA GPUs are required even on headless (no graphical user interface installed) Debian servers to encode/decode the media files, run the artificial intelligence codes, run the CUDA programs, and much more.
In this article, we will show you how to install the official NVIDIA GPU drivers on a headless Debian 11 server machine.
Topic of Contents:
- Connecting to the Debian 11 Server Machine via SSH
- Checking If the NVIDIA GPU Is Installed
- Enabling the Contrib and Non-Free Package Repositories on Debian 11
- Installing the NVIDIA Drivers on Headless Debian 11 Server
- Checking If the NVIDIA Drivers Are Installed Correctly on the Debian 11 Server
- Uninstalling the NVIDIA Drivers from Debian 11
- Conclusion
- References
Connecting to the Debian 11 Server Machine via SSH
Connecting to your Debian 11 server machine via SSH is optional if you have access to the server hardware (where you installed the Debian 11). You can just attach a mouse, a keyboard, and a monitor to the server and install the NVIDIA drivers on it.
If you don’t have access to the Debian 11 server hardware, you need to SSH into it to install the NVIDIA drivers.
To SSH into your Debian 11 server machine, you can run the following command from a terminal app of your desktop/laptop from which you want to access it:
Make sure to replace the <username> and <hostname/ip-address> with the login username and domain name or the IP address of your Debian 11 server machine, respectively.
If you’re using the Windows 10 or Windows 11 and you need any assistance in connecting to your Debian 11 server machine via SSH, read the article on How to SSH into the Linux Servers from Windows 10/11.
Checking If the NVIDIA GPU Is Installed
To check whether you have an NVIDIA GPU installed on your Debian 11 server machine, run the following command:
As you can see, we have an NVIDIA GeForce 1050 Ti GPU installed on our Debian 11 server machine.
Also, from the output of the following commands, you can see that the open-source nouveau drivers are 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 Debian 11 server.
$ lsmod | grep nouveau
Enabling the Contrib and Non-Free Package Repositories on Debian 11
To install the official NVIDIA drivers on your Debian 11 server, you need to enable the contrib and non-free package repositories on your Debian 11 server.
To easily manage the official Debian 11 package repositories, you can use the apt-add- command repository. This command may not be available by default on your Debian 11 server. But, you can easily install it from the official package repository of Debian 11.
First, update the APT package repository cache with the following command:
Then, install the software-properties-common package with the following command:
To confirm the installation, press Y and then press <Enter>.
The software-properties-common package and the required dependency packages are being installed. It takes a while to complete.
The software-properties-common package and the required dependency packages are installed at this point.
To enable the official Debian 11 contrib package repository, run the following command:
The official Debian contrib package repository should be enabled.
To enable the official Debian 11 non-free package repository, run the following command:
The official Debian non-free package repository should be enabled.
For the changes to take effect, update the APT package repository cache with the following command:
Installing the NVIDIA Drivers on Headless Debian 11 Server
To install the official NVIDIA drivers on your headless Debian 11 server, run the following command:
To confirm the installation, press Y and then press <Enter>.
The NVIDIA drivers packages and the required dependency packages are being downloaded. It takes a while to complete.
The NVIDIA drivers packages and the required dependency packages are being installed. It takes a while to complete.
Once you see the following window, press <Tab> to select OK. Then, press <Enter>.
The installation of the NVIDIA drivers packages should continue. The installation should be finished shortly.
Once the NVIDIA drivers are installed, restart your Debian 11 server machine for the changes to take effect.
Checking If the NVIDIA Drivers Are Installed Correctly on the Debian 11 Server
Once your Debian 11 server boots, you can verify that the NVIDIA kernel modules are used instead of the open-source nouveau kernel modules with the following commands. So, the official NVIDIA GPU drivers are working just fine:
$ lsmod | grep nvidia
You can also find the usage information of your NVIDIA GPU using the nvidia-smi command. The output of this command also verifies that your NVIDIA GPU drivers are installed correctly.
Uninstalling the NVIDIA Drivers from Debian 11
If you want to uninstall the NVIDIA drivers from your Debian 11 server and you need any assistance, read the article on How to Clean Install the NVIDIA Drivers on Debian 11.
Conclusion
We showed you how to enable the contrib and non-free package repositories on a headless Debian 11 server. We also showed you how to install the official NVIDIA drivers on a headless (no graphical user interface installed) Debian 11 server and how to verify if the official NVIDIA GPU drivers are working on the Debian 11 server.