How To

Install NVIDIA Drivers and CUDA Toolkit on Ubuntu 26.04 / 24.04

A working NVIDIA GPU on Ubuntu comes down to three things: the kernel driver, the CUDA toolkit, and a quick test that proves both. This guide installs the NVIDIA drivers and the CUDA toolkit on Ubuntu 26.04 and 24.04 from a clean system, using the open kernel modules that NVIDIA now ships by default, and finishes by compiling a real CUDA program on the card.

Original content from computingforgeeks.com - post 170293

The old advice (third-party PPAs, the .run installer, blacklisting nouveau by hand) is retired. The current path is NVIDIA’s own apt repository: one keyring, one driver package, one toolkit package. Every command below was run on a clean Ubuntu 26.04 (kernel 7.0) and Ubuntu 24.04 (kernel 6.17) box with an NVIDIA A10G, driver 610.43.02 and CUDA 13.3, in July 2026.

Prerequisites

You need an actual NVIDIA card and root on the machine. The open kernel modules cover Turing and newer (GTX 16-series, RTX 20-series, and up); older cards use the proprietary driver, which this guide also covers. If you are still sizing hardware, see how much VRAM you need to run an LLM and the best GPU for LLMs breakdown first.

  • An NVIDIA GPU (Turing or newer for the open modules).
  • Ubuntu 26.04 LTS or 24.04 LTS, x86_64, with sudo.
  • About 8 GB of free disk for the toolkit and the sample programs.
  • One reboot. The kernel driver needs it.

Add the CUDA repository

Start with the packages the driver needs to build its kernel module. The DKMS build wants a compiler and the headers for your running kernel:

sudo apt update
sudo apt install -y build-essential linux-headers-$(uname -r)

NVIDIA publishes a separate repository per Ubuntu release. Detect yours so the same commands work on both 26.04 and 24.04:

distro=$(. /etc/os-release && echo "ubuntu${VERSION_ID/./}")
echo "$distro"

On 26.04 this prints ubuntu2604; on 24.04 it prints ubuntu2404. That single variable is the only thing that changes between the two releases, and NVIDIA ships the same driver and toolkit for both. Add the signed repository with the keyring package:

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

The keyring drops NVIDIA’s GPG key and repo definition in place. After the refresh, the driver and toolkit packages resolve straight from NVIDIA.

Install the NVIDIA driver

NVIDIA now ships open kernel modules as the default, and they are what you want on any recent card. Pick the package that matches your GPU generation before you install anything. This is the one decision that trips people up:

PackageKernel modulesUse it for
nvidia-openOpenTuring and newer (GTX 16, RTX 20/30/40/50, A- and H-series). The default.
cuda-driversProprietaryMaxwell, Pascal, or Volta, or when the open modules misbehave.

On Turing and newer, install the open modules. One package pulls the driver and builds the module through DKMS:

sudo apt install -y nvidia-open

Maxwell, Pascal, and Volta cards take the proprietary modules instead. Install one or the other, never both:

sudo apt install -y cuda-drivers

One gotcha before you reboot: on a machine with Secure Boot enabled, the DKMS-built modules must be signed and their key enrolled, so the first reboot shows a blue MOK screen where you choose Enroll MOK and enter the password apt prompted you for. Check your state with mokutil --sb-state. If it reports Secure Boot disabled, there is nothing to enroll. Now reboot so the module loads:

sudo reboot

Reconnect after the box comes back and confirm the card is visible:

nvidia-smi

The card shows up with its driver branch and the CUDA version the driver supports. Note the 610-series header format: it now reports a separate KMD Version (the kernel module) and CUDA UMD Version (the user-mode driver), where older releases printed a single Driver Version and CUDA Version.

nvidia-smi showing NVIDIA A10G with driver 610.43.02 and CUDA 13.3 on Ubuntu 26.04

To confirm you are actually running the open module rather than the proprietary one, read the driver version file:

cat /proc/driver/nvidia/version

The words Open Kernel Module in the output are the proof:

NVRM version: NVIDIA UNIX Open Kernel Module for x86_64  610.43.02  Release Build

Install the CUDA toolkit on Ubuntu

The driver gives you a working GPU; the toolkit gives you nvcc, the CUDA libraries, and the headers you compile against. The meta package always pulls the current release:

sudo apt install -y cuda-toolkit

Installing cuda-toolkit keeps the driver you already chose. To pin one specific release instead of the latest, install its versioned package, for example cuda-toolkit-13-3. Either way, the toolkit lands under /usr/local/cuda, which is a symlink to the versioned directory. Add it to your PATH so the compiler and libraries resolve:

echo 'export PATH=/usr/local/cuda/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc

Check the compiler reports the release you expect:

nvcc --version

The version line and build date confirm the toolkit is on your PATH:

Cuda compilation tools, release 13.3, V13.3.73
Build cuda_13.3.r13.3/compiler.38244171_0

Verify with a real CUDA program

nvidia-smi proves the driver. To prove the toolkit compiles and the GPU actually runs code, build NVIDIA’s sample programs. They use CMake now, so grab it along with git. The default branch tracks the current toolkit, so it matches a fresh cuda-toolkit install; if you pinned an older CUDA release, check out the samples tag that matches it (for example git checkout v13.3).

sudo apt install -y cmake git
git clone --depth 1 https://github.com/NVIDIA/cuda-samples.git
cd cuda-samples
cmake -B build
cmake --build build --target deviceQuery vectorAdd -j$(nproc)

On Ubuntu 26.04 the host compiler is GCC 15, and CUDA 13.3 builds against it cleanly with no -ccbin workaround, which was a recurring headache on older toolkit and compiler combinations. Run deviceQuery first. It reports the card’s compute capability, core count, and memory:

./build/cpp/1_Utilities/deviceQuery/deviceQuery

A healthy install ends with Result = PASS. On the A10G that means compute capability 8.6 and 10240 CUDA cores:

nvcc version and CUDA deviceQuery Result PASS on an NVIDIA A10G on Ubuntu

vectorAdd goes one step further. It copies data to the GPU, launches a kernel, and copies the result back, so a pass means the whole chain works end to end:

./build/cpp/0_Introduction/vectorAdd/vectorAdd

Test PASSED is the sign-off: driver, toolkit, and card are all talking to each other.

CUDA vectorAdd sample printing Test PASSED after a kernel launch on Ubuntu

Both releases ran this exact sequence. The only difference was the kernel the module built against (7.0 on 26.04, 6.17 on 24.04), which DKMS handles transparently, so the driver rebuilds itself after a kernel upgrade too.

The whole install, in order

Copy this block on a fresh box and you go from no driver to a GPU that compiles CUDA in a couple of minutes plus one reboot:

sudo apt update
sudo apt install -y build-essential linux-headers-$(uname -r)
distro=$(. /etc/os-release && echo "ubuntu${VERSION_ID/./}")
wget https://developer.download.nvidia.com/compute/cuda/repos/${distro}/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt update
sudo apt install -y nvidia-open
sudo reboot
# after the reboot:
sudo apt install -y cuda-toolkit
echo 'export PATH=/usr/local/cuda/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc
nvidia-smi
nvcc --version

That is the full path from a bare Ubuntu box to a GPU that runs CUDA. With the driver and toolkit in place, the next step is usually to run a local LLM with Ollama, serve models with vLLM, or run one with llama.cpp. For a full box built around the card, see the local AI workstation build.

Keep reading

Upgrade Ubuntu 24.04 to Ubuntu 26.04 LTS (Step by Step) Ubuntu Upgrade Ubuntu 24.04 to Ubuntu 26.04 LTS (Step by Step) UFW Firewall Commands with Examples on Ubuntu 24.04 / 22.04 Security UFW Firewall Commands with Examples on Ubuntu 24.04 / 22.04 Backup and Restore Linux Systems with Timeshift Debian Backup and Restore Linux Systems with Timeshift Install Arcane on Ubuntu 26.04 / 24.04: Complete Docker UI Guide Containers Install Arcane on Ubuntu 26.04 / 24.04: Complete Docker UI Guide Install Ollama on Ubuntu 26.04 LTS with Open WebUI AI Install Ollama on Ubuntu 26.04 LTS with Open WebUI Use NetworkManager nmcli on Ubuntu and Debian Debian Use NetworkManager nmcli on Ubuntu and Debian

Leave a Comment

Press ESC to close