Users running Debian 12 Linux desktops or laptops with Nvidia graphics cards will need the Nvidia drivers to use the power of graphic cards for performing gaming, 3D rendering, video editing, and other graphic intense tasks. So, if you don’t have idea how to install the drivers for NVIDIA GPU on Debian Linux then follow the steps given in this tutorial.
Note: The given steps can be used for Debian 10 or 11 as well…
Step 1: Add the Non-free Repository
NVIDIA drivers are not some open source packages, hence being a proprietary software they are not available to install through the system default main or standard repository of Debian. However, we can enable a “non-free” component in our source list to get the proprietary packages.
The given command will automatically add “non-free non-free-firmware” at the end of each Debian repository URL you have in your ‘/etc/apt/sources.lis
t’.
sudo sed -i '/^deb .*main$/ s/$/ non-free non-free-firmware/' /etc/apt/sources.list
To check it you can use:
cat /etc/apt/sources.list
Step 2: Update Debian 12 Linux
After appending the Debian 12 repositories with a “non-free” value, run the system update command once. This will force the system to rebuild the APT package index cache and also install the new updates if available.
sudo apt update && sudo apt upgrade
Step 3: Install a few essential Packages
There are a few packages such as Linux kernel headers, DKMS, and build-essential we require on our Debian system before installing the NVIDIA drivers. However, in most cases this package would be installed automatically by running the driver installation command, however, it is better to install them manually.
sudo apt install linux-headers-$(uname -r) build-essential dkms
Step 4: Install the NVIDIA Driver on Debian 12
Now, we can issue the NVIDIA driver installation command that will download the required packages compatible with our system-installed graphic card.
sudo apt install nvidia-driver
If you want to ensure that your Debian Linux can detect your GPU, then install the following package.
sudo apt install nvidia-detect
Now, to detect the card just type:
nvidia-detect
Step 5: Reboot Your System
Once the driver is installed, reboot your system to apply the changes:
sudo reboot
Troubleshooting
If you encounter issues after installation, you might need to verify that the NVIDIA kernel module is loaded correctly:
lsmod | grep nvidia
If the module is not listed, you may need to load it manually:
sudo modprobe nvidia
Conclusion
Installing NVIDIA drivers on Debian 12 is quite easy, we have shown the command that will automatically install the correct driver for your graphic card for optimal performance on a Linux system.