Introduction
NVIDIA GPUs (Graphics Processing Units) have various uses, including gaming, 3D rendering, cryptocurrency mining, deep learning, and machine learning. Keeping the drivers for these GPUs up to date ensures your system performs at peak efficiency.
In this tutorial, we will guide you through the NVIDIA driver installation process on Debian.
Prerequisites
- A system running Debian (the guide uses Debian 12 Bookworm).
- An account with sudo privileges.
- Access to the terminal window.
- (Optional) Access to a web browser.
Note: If you are working on an older machine, use the nvidia-detect tool to determine the appropriate driver version. Install it with sudo apt nvidia-detect
and run nvidia-detect
as a command to determine the appropriate driver version.
Install NVIDIA Drivers Via Debian Repository
The first method focuses on installing NVIDIA drivers from the Debian repositories. NVIDIA recommends using this method for Linux systems due to improved interactions.
Follow the steps below to install the drivers via the Debian repository.
Step 1: Enable Non-Free Repositories
Adjust the APT sources list to include non-free repositories before installing. To enable them, do the following in the terminal:
1. Open the APT sources list file using a text editor:
sudo nano /etc/apt/sources.list
2. Add the contrib and non-free repositories to the sources list links. For example:
deb http://deb.debian.org/debian/ bullseye main contrib non-free
Enabling the repositories gives access to proprietary drivers that are not open source, including NVIDIA drivers.
3. Press Ctrl+X, Y, and Enter to save changes and exit the configuration file.
4. Update the system repository index:
sudo apt update
The update ensures the newest data from the added repositories is available.
Step 2: Install NVIDIA Drivers
To install the driver, see the steps below:
1. Run the following apt command to install the driver:
sudo apt install nvidia-driver
The command also installs necessary dependencies. Press y and Enter to confirm the installation.
2. If the system prompts that there is a conflicting driver, a restart after the installation resolves the issue.
Press Enter to confirm and continue the installation.
3. Once the installation completes, reboot your system with:
sudo reboot
The driver loads immediately after reboot.
Install NVIDIA Drivers Via Official nvidia.com Package
This method lets you manually download and install an NVIDIA driver package from the official website.
Step 1: Download Drivers
To download the NVIDIA driver installer, do the following:
1. Navigate to the Unix driver archive in a web browser and find the appropriate driver version download link. The latest production version is compatible with all modern NVIDIA GPUs.
Click the version number to access the downloads page.
2. Click the Download button and save the file.
The file is in the ~/[username]/Downloads directory of the currently logged-in user.
Step 2: Install Driver Prerequisites
Install the driver prerequisites. Run the following in the terminal:
sudo apt -y install linux-headers-$(uname -r) build-essential libglvnd-dev pkg-config
The packages ensure that NVIDIA drivers compile successfully.
Step 3: Disable Default Drivers
Disable the default nouveau GPU driver:
1. Create and open a new configuration file using nano:
sudo nano /etc/modprobe.d/blacklist-nouveau.conf
The configuration file is in the kernel module loading directory.
2. Add the following lines to the file:
blacklist nouveau
options nouveau modeset=0
The file instructs the system to prevent the Nouveau kernel module from loading and disables the open-source driver.
3. Save the changes and exit. Press Ctrl+X, Y, and Enter.
4. Update the kernel initramfs with:
sudo update-initramfs -u
The rebuild takes several moments to complete. It ensures that essential drivers load and the root filesystem mounts early in the boot process. It ensures the changes apply after rebooting.
Step 4: Reboot to Multi-User Login
Since the default GPU drivers are now disabled, switching to a text-based interface lets you install NVIDIA drivers without using the GUI.
1. Enable the text-based multi-user login prompt:
sudo systemctl set-default multi-user.target
The command creates a symlink and outputs the result.
2. Reboot the system with:
systemctl reboot
The system restarts into the terminal without a GUI.
Step 5: Install Nvidia Drivers
Once the system restarts, do the following:
1. Log in as root.
2. Navigate to the directory where the driver file is downloaded:
cd /home/[username]/Downloads
3. Install the Nvidia drivers using the package you downloaded:
bash ./[driver file name]
For example:
bash ./NVIDIA-Linux-x86_64-550.127.05.run
3. If prompted, choose the following options during the install process:
- The CC version check failed: Ignore CC version check.
- Install NVIDIA's 32-bit compatibility libraries: Yes.
- Rebuild initramfs: Yes.
- An incomplete installation of libglvnd was found. Do you want to install a full copy of libglvnd? This will overwrite any existing libglvnd libraries: Install and overwrite existing filesort installation.
- Would you like to run the nvidia-xconfig utility to automatically update your X configuration file so that the NVIDIA X driver will be used when you restart X? Any pre-existing X configuration file will be backed up: Yes.
4. Wait for the process to complete until it shows the installation was successful.
Press Enter to confirm and exit the installer. The prompt returns to the terminal.
Step 6: Enable GUI
Re-enable the GUI to complete the process and start up the new drivers:
1. Enable the GUI login prompt with:
systemctl set-default graphical.target
2. Reboot your system to finish the installation:
reboot
The system starts up using the new driver.
Conclusion
This guide showed how to install the newest NVIDIA GPU drivers on Debian 12 using two different methods.
For other systems, see our guides on installing NVIDIA drivers on Ubuntu, NVIDIA Tesla drivers on Linux and Windows, or installing NVIDIA Drivers on Fedora.