Search Our Database

Installing Nvidia GPU Driver on Debian: A Step-by-Step Guide

Last updated on |

Introduction

Nvidia GPUs power many of today’s advanced computing tasks, from graphic design to AI and machine learning.

To get the most out of your Nvidia GPU, it’s essential to install the correct drivers.

This guide will walk you through installing Nvidia GPU drivers on Debian, step-by-step.

We’ll also cover optional tools, such as the CUDA Toolkit and Nvidia Container Toolkit, which can unlock additional features and capabilities.

Follow along to set up your Nvidia GPU quickly and easily!

 

🚀 GPU Software Components Overview

Component Required? Purpose When You Need It
NVIDIA Driver ✅ Yes Enables the system to detect and communicate with the NVIDIA GPU. Always required for the GPU to function.
CUDA Toolkit ⚙️ Optional Provides tools and libraries for GPU-accelerated apps (like AI/ML). Needed only if your app depends on CUDA or you’re developing.
Container Toolkit ⚙️ Optional Allows Docker containers to access the GPU hardware. Needed only if you’re using containers with GPU workloads.

 

Prerequisites

  • Debian operating system installed
  • Administrative (sudo) privileges
  • Compatible Nvidia GPU hardware
  • Internet connectivity for package downloads

 

Installation Procedure

Step 1: System Update

Begin by updating the package list to ensure you have access to the latest software versions:

sudo apt update
sudo apt upgrade -y

Step 2 : Check Kernel Edition and Install Kernel Headers

Check your running kernel version to determine if you are using a cloud-specific kernel.

uname -r
If output contains the word “cloud”, install the cloud-specific kernel headers.
Otherwise, install the standard kernel headers:
sudo apt install -y linux-headers-amd64
or, if using a cloud kernel:
sudo apt install -y linux-headers-cloud-amd64

Step 3 : Configure Debian Repositories

For Debian 12 (Bookworm)

You need to enable the contrib , non-free , and non-free-firmware repositories in your /etc/apt/sources.list file.

sudo sed -i '/^deb http:\/\/deb.debian.org\/debian bookworm/ s/main$/main contrib non-free non-free-firmware/' /etc/apt/sources.list

Then, create a configuration snippet to ensure NVIDIA modules are properly handled by the initramfs system:

echo 'install_items+=" /etc/modprobe.d/nvidia-blacklists-nouveau.conf /etc/modprobe.d/nvidia.conf /etc/modprobe.d/nvidia-options.conf "' | sudo tee -a /etc/dracut.conf.d/10-nvidia.conf

For Debian 11 (Bullseye)

Enable the contrib and non-free repositories by adding this line to your /etc/apt/sources.list file:

sudo sed -i '/^deb http:\/\/deb.debian.org\/debian bullseye/ s/main$/main contrib non-free/' /etc/apt/sources.list

Step 4 : Update your package lists again

sudo apt update

Step 5 : Install NVIDIA Drivers and Firmware

With repositories configured and system updated, install the NVIDIA driver packages along with miscellaneous firmware required by the GPU:

sudo apt install -y nvidia-driver firmware-misc-nonfree

Step 6: System Reboot

To complete the installation and load the new NVIDIA kernel modules, reboot your system:

sudo reboot

Step 7: GPU Driver Verification

To make sure everything’s working as it should, run:

nvidia-smi

If you see your GPU info pop up, you’re all set! 🎉

 

Optional : Installing Nvidia CUDA Toolkit

Running a CUDA application requires the system with at least one CUDA capable GPU and a driver that is compatible with the CUDA Toolkit.

Step 1: Download Nvidia CUDA Keyring according to your Debian version

For Debian 12 (Bookworm)

wget https://developer.download.nvidia.com/compute/cuda/repos/debian12/x86_64/cuda-keyring_1.1-1_all.deb

For Debian 11 (Bullseye)

wget https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64/cuda-keyring_1.1-1_all.deb

Step 2 : Add Nvidia CUDA Keyring and Install Nvidia CUDA Toolkit

sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt-get update
sudo apt-get -y install cuda-toolkit

Step 3 : Add CUDA Toolkit into PATH variable

echo 'export PATH=${PATH}:/usr/local/cuda/bin' >> /etc/bash.bashrc
export PATH=${PATH}:/usr/local/cuda/bin

Step 4 : CUDA Toolkit verification

nvcc --version

If you see NVIDIA (R) Cuda compiler driver info pop up, you’re all set! 🎉

 

Optional : Installing Nvidia Container Toolkit

The NVIDIA Container Toolkit is a collection of libraries and utilities enabling users to build and run GPU-accelerated containers.
Required if you want to use GPU within Docker

Step 1 : Configure the production repository

curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg 
  && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | 
    sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | 
    sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list

Step 2 : Update the packages list from the repository

sudo apt-get update

Step 3 : Install the NVIDIA Container Toolkit packages

sudo apt-get install -y nvidia-container-toolkit
nvidia-ctk runtime configure --runtime=docker

Step 4 : Restart Docker

systemctl restart docker

Step 5 : Nvidia Container Toolkit verification

docker run --pull=always --rm --gpus all ubuntu nvidia-smi

If you see your GPU info pop up, you’re all set! 🎉

 

Conclusion

By following this guide, you’ve successfully installed the NVIDIA GPU drivers on your Debian system.

Your system is now ready to handle GPU-powered applications, including deep learning frameworks, rendering software, and other high-performance tasks.

If you have any questions or need additional help, please open a ticket through your Customer Portal account or email us directly at support@ipserverone.com.

We’re always here to help!