5 min read

NVIDIA Toolkit Setup on Linux

NVIDIA Toolkit Setup on Linux
Photo by Mariia Shalabaieva / Unsplash

Introduction / why?

Now I'm actually a bit of an underdog (AMD) fanboy, but in the end a real tech/nerd uses the best tool available, to do the job. NVIDIA is wearing the King's crown for GPU accelerated functions like video transcoding and especially, AI.

This guide will walk you through installing the NVIDIA Toolkit, drivers, and setting up your docker runtime to make use of it for GPU acceleration of any dockers you so chose, such as Plex / Jellyfin!

Prerequisites

Part 1 - Linux Driver install (Apt way)

💡
You may have to disable secure boot from BIOS - google that on your specific motherboard! If you don't want to do that you have to go through the process of installing nvidia mok key.

Installing NVIDIA drivers is a piece of cake on Debian based systems. We can install right from apt repository or, from direct download. I recommend the apt repo b/c it's simpler and will update for you when a new version is released by NVIDIA.

First, update your apt repository if you have not done so yet. Use your fav text editor like nano to edit source.list found here:

**Backup** your existing sources.lists!
cp /etc/apt/sources.list /etc/apt/sources.list.bak
nano /etc/apt/sources.list

**For Debian 12** - Replace yours with:
deb https://deb.debian.org/debian bullseye main contrib non-free
deb https://deb.debian.org/debian bullseye-updates main contrib non-free
deb https://deb.debian.org/debian-security bullseye-security main contrib non-free

For Debian 13 Trixie:

deb https://deb.debian.org/debian trixie main contrib non-free non-free-firmware
deb https://deb.debian.org/debian trixie-updates main contrib non-free non-free-firmware
deb https://deb.debian.org/debian-security trixie-security main contrib non-free non-free-firmware

Once you've done that, you're /etc/apt/sources.list should look something like:

deb http://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware
deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
deb http://deb.debian.org/debian/ bookworm-updates main contrib non-free non-free-firmware

Now, install the new drivers!

# Do an apt update with your new sources and upgrade everything, so there's nothing waiting or in the way.
sudo apt update && sudo apt upgrade

# Last upgrade step, moves you from a minor upgrade to a major, if there's any.
sudo apt full-upgrade

# Cleanup!

sudo apt --purge autoremove
sudo reboot

# Search apt for NVIDIA drivers if you want.
sudo apt search nvidia-driver
# At the time of writing the latest driver is 575.57.08

# Install headless server drivers.
sudo apt install nvidia-headless-575-server

# Install NVIDIA Utils (gives us nvidia-smi!)
sudo apt install nvidia-utils-575-server

# Search apt for libnvidia-encode. Needed for things like transcoding.
sudo apt search nvidia-encode

# Install libnvidia-encode package.
sudo apt install libnvidia-encode-575-server

Code for installing drivers

After installing all the packages and rebooting (if needed), check if everything is working as it should. Type:

nvidia-smi
Mon Aug 11 09:14:35 2025
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 570.124.04             Driver Version: 570.124.04     CUDA Version: 12.8     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce RTX 3060        Off |   00000000:2E:00.0 Off |                  N/A |
| 39%   44C    P0             45W /  170W |     405MiB /  12288MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI              PID   Type   Process name                        GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|    0   N/A  N/A         1580836      C   frigate.detector.tensorrt               266MiB |
|    0   N/A  N/A         3645798      C   /usr/lib/ffmpeg/7.0/bin/ffmpeg          125MiB |
+-----------------------------------------------------------------------------------------+

What NVIDIA-SMI looks like post driver install.


Part 2 - Installing NVIDIA container toolkit

Now that we're here, we've got 1 more package repo to add/fixup. Copy this whole code block and paste it into your CLI.

# Add the gpgpkey and 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

If you're already root, remove the sudos in this code block!

If that took, you should get a blank prompt but no errors.

Install the Toolkit, finally

# Update and install NVIDIA Container Toolkit
sudo apt-get update

sudo apt-get install -y nvidia-container-toolkit

# Configure NVIDIA Container Toolkit
sudo nvidia-ctk runtime configure --runtime=docker

sudo systemctl restart docker

Step 3 - Testing / Verification

Now check that everything is running properly, test it out and ensure everything is running properly. We have 2 ways to do this. One is just checking docker itself and another is more intensive, downloading and running a test docker from NVIDIA and actually having it utilize the GPU.

Docker Runtime check.

docker info (sudo docker info if you didn't setup a user properly!)

You should see something like this, look for the 'Runtimes:' line (Bolded). You're looking to see it says nvidia in there.

Output of command docker info

Client: Docker Engine - Community
Version: 28.3.3
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.26.1
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.39.1
Path: /usr/libexec/docker/cli-plugins/docker-compose

Server:
Containers: 55
Running: 54
Paused: 0
Stopped: 1
Images: 52
Server Version: 28.3.3
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
CDI spec directories:
/etc/cdi
/var/run/cdi
Swarm: inactive
Runtimes: io.containerd.runc.v2 nvidia runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 05044ec0a9a75232cad458027ca83437aae3f4da
runc version: v1.2.5-0-g59923ef
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.12.30+bpo-amd64
Operating System: Debian GNU/Linux 12 (bookworm)
OSType: linux
Architecture: x86_64
CPUs: 16
Total Memory: 62.73GiB
Name: codex
ID: efa2c03f-60b2-4948-a862-303f7e7b5273
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
::1/128
127.0.0.0/8
Live Restore Enabled: false

Running a docker with GPU acceleration

This is as easy as typing:

docker run --gpus all nvidia/cuda:13.0.0-base-ubuntu24.04 nvidia-smi

If that doesn't work due to drivers / type of GPU you have let's try and older one:

docker run --gpus all nvidia/cuda:11.5.2-base-ubuntu20.04 nvidia-smi
💡
This is running a mini Ubuntu instance with nvidia-smi on it, so when you're paassing that command to the docker, it's telling you that it does in fact have access to the NVIDIA GPU and the drivers! Congrats!

Cleanup Time: Warning this is a "Deep clean!"

docker system prune -a
Hit "y" so it removes any extra images/docker cruft from us playing.

WARNING: It removes


Now you're ready to utilize that GPU to accelerate everything and anything you'd like to do in your self-hosted lab, like using it for Plex, or running your very own large language AI model at home!