How to Add Nvidia Drivers to Your Debian Installation

For many Debian users, particularly those who engage in gaming or graphic-intensive tasks, adding Nvidia drivers to their system is essential for optimal performance. Here’s how you can install Nvidia drivers on your Debian installation:
1.Identify your Nvidia card
Before you begin, you need to know which Nvidia graphics card is installed in your system. You can do this by opening a terminal and running:
“`shell
lspci -nn | grep -invidia
“`
This command will display the model of your Nvidia graphics card.
2.Add “non-free” repositories
By default, Debian comes with free software only, which means the non-free Nvidia drivers aren’t included. To install them, you need to add the non-free repository to your sources list.
Open `/etc/apt/sources.list` using a text editor with root privileges and add `non-free` to the repository lines. It should look something like this:
“`plaintext
deb http://deb.debian.org/debian/ buster main contrib non-free
“`
3.Update your package lists
After you have adjusted your `sources.list`, save it and update your package database with the following command:
“`shell
sudo apt-get update
“`
4.Install the appropriate driver
Depending on your card series, there may be a different version of the driver that’s recommended. To install the latest driver that supports most cards, use:
“`shell
sudo apt-get install nvidia-driver
“`
The system should automatically select the correct driver version for you.
For older cards, you might need to manually find which legacy driver is compatible with your card.
5.Building the kernel module
After installing, a kernel module will be built for your system. This process is automatic, but it may take some time depending on your system’s capabilities.
6.Reboot your system
Once the process is complete and there were no error messages, reboot your system with:
“`shell
sudo reboot
“`
7.Verify installation
After rebooting, verify that the driver is installed correctly by running:
“`shell
nvidia-smi
“`
This command should give you information about the driver version and graphics card usage.
And there you have it! Your Debian installation now has Nvidia drivers installed and should be utilizing hardware acceleration for video games and other graphically intensive applications. Always check compatibility with your specific GPU model and review any warnings or recommendations from both Debian documentation and Nvidia before proceeding with installations or upgrades.