NVidia Driver and CUDA on Debian

To install NVidia proprietary driver on Debian, it's often just 'sudo apt-get install nvidia-driver'.

If you need a newer driver directly from NVidia, these short notes show you how.

Short notes: this is not an extensive tutorial, these are short notes.

Install latest NVidia driver - for games

Add NVidia repostory, creates a new trust relationship.

$ wget https://developer.download.nvidia.com/compute/cuda/repos/debian12/x86_64/cuda-keyring_1.1-1_all.deb
$ sudo dpkg -i cuda-keyring_1.1-1_all.deb
$ sudo apt-get update

Install Nvidia driver. This is the "open" driver, for some small values of "open". The drivers in NVidia's repository are often much newer than those in the official Debian repositories.

$ sudo apt-get install linux-headers-$(uname -r) dkms
$ sudo apt-get install nvidia-open

Reboot.

Optionally, you can see your driver version with 'nvidia-smi'.

That's it. If you just want to play games, you can now buy KCDII from Gog and start Heroic Launcher.

Install CUDA - for AI & cracking passwords

CUDA is the toolkit needed for making calculations with your GPU. It's needed for artificial intelligence (large language models) and cracking password hashes. Your parents might have mined BitCoin with it, too.

$ sudo apt-get install cuda-toolkit

If you actually want to code with it, you might need additional packages.

$ sudo apt-get install g++ freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libglu1-mesa-dev libfreeimage-dev libglfw3-dev

Tricks

Test CUDA with hashcat

You can test CUDA with hashcat. Crack some password with hashcat. Without CUDA, hashcat says "CUDA SDK Toolkit not installed or incorrectly installed.". With CUDA, hashcat says "CUDA API (CUDA 13.0)".

NVidia PGP key 3bf863cc

This is the cuda-keyring package with the key used in this tutorial. If you want to check before installing, you can 'ar x' the package, then verify and install the two files manually (sources.list and trusted key).

$ sha512sum cuda-keyring_1.1-1_all.deb
719c13aae63476c6a66e08f28c5838aadff50f381de36dcacfc01ab523f58dc5a188f7a45914a2a2069131b6c2f35cbb0c71dbdfb75484e20d95a4ee62a2bfb1  cuda-keyring_1.1-1_all.deb

Key installed with cuda-keyring_1.1-1_all.deb

$ gpg --show-key --with-fingerprint /usr/share/keyrings/cuda-archive-keyring.gpg
pub   rsa4096 2022-04-14 [SC]
      EB69 3B30 35CD 5710 E231  E123 A4B4 6996 3BF8 63CC

The same key is mentioned in NVidia docs.

Sources

NVidia 2025: CUDA Installation Guide for Linux

NVidia 2025: NVIDIA Driver Installation Guide

Debian Wiki: Nvidia Proprietary GPU Drivers