How to Install NVIDIA Drivers on Debian

November 20, 2024

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.

How to install NVIDIA drivers on Debian

Prerequisites

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
apt sources.list contrib non-free debian 12

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
sudo apt install nvidia-driver terminal output debian 12

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.

conflicting nouveau kernel module message

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.

Nvidia Unix driver archive 550.127.05 version download

Click the version number to access the downloads page.

2. Click the Download button and save the file.

Linux NVIDIA driver 550.127.05 download

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
sudo apt install nvidia prerequisites terminal output

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
blaclist-noveau.conf file contents

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
sudo update-initramfs -u terminal output

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
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.

Debian 12 login root output

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
bash nvidia driver run terminal output

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.

installation complete nvidia driver version 550.127.05 output

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
set-default graphical.target terminal output

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.

Was this article helpful?
YesNo
Milica Dancuk
Milica Dancuk is a technical writer at phoenixNAP with a passion for programming. With a background in Electrical Engineering and Computing, coupled with her teaching experience, she excels at simplifying complex technical concepts in her writing.
Next you should read
How to Install Jenkins on Debian 10 (Buster)
June 15, 2020

If you are a software developer working on a Debian 10 Buster you may want to install Jenkins. Jenkins is software that automates different aspects of building, testing, delivering, and deploying of software applications.
Read more
How to Install Docker on Debian
September 26, 2024

Docker is a virtual container management tool that speeds up and improves application development. Created containers share the kernel and other resources, but are also isolated from one another.
Read more
How to Install phpMyAdmin on Debian 12
November 20, 2024

The phpMyAdmin utility is a web-based graphical database management tool. By installing phpMyAdmin, you no longer need to use the default command-line interface to manage databases.
Read more
How to Generate & Set Up SSH Keys on Debian 10
September 14, 2020

This article will help system administrators configure SSH Keys on Debian 10. The instructions allow you to set up encrypted credentials quickly, log in remotely, and disable authentication.
Read more