How to Install NVIDIA CUDA on Ubuntu 22.04

Deepak Prasad
Tested on Ubuntu 22.04 LTS (Jammy Jellyfish), x86_64 — NVIDIA ubuntu2204 repository and apt package layout (no CUDA-capable GPU on lab host)
Package NVIDIA repo cuda-toolkit 13.4.3-1 (ubuntu2204)
Ubuntu multiverse nvidia-cuda-toolkit (~11.5.x)
Applies to Ubuntu 22.04 LTS (amd64 and arm64 SBSA use the matching repo arch)
Privilege sudo for drivers and packages
Scope Install CUDA Toolkit on Ubuntu 22.04 from NVIDIA’s network repository, verify or install a compatible NVIDIA driver, set PATH for nvcc, and run basic checks. Covers Turing-and-newer GPUs for CUDA 13.x; Maxwell/Pascal/Volta need CUDA 12.x. Native Ubuntu only—not WSL2, Jetson, or runfile-only installs.
Related guides Install CUDA on Ubuntu 26.04
Install CUDA on Ubuntu 24.04
Install NVIDIA drivers on Ubuntu
Check Ubuntu version
NOTE
Ubuntu 24.04 or 26.04? Use the matching guide: CUDA on Ubuntu 24.04 or CUDA on Ubuntu 26.04.
Short on time?Beta Get the gist of this 4-minute read in seconds, then ask follow-up questions

CUDA on Ubuntu 22.04 follows the same two-layer model as other LTS releases: a proprietary NVIDIA driver and the CUDA Toolkit for building GPU code. NVIDIA lists 22.04 in the CUDA Linux installation guide with repository codename ubuntu2204.

Jammy’s multiverse nvidia-cuda-toolkit package is much older (roughly 11.5.x) than what most ML stacks expect today. For CUDA 13, add NVIDIA’s network repository as below instead of relying on the distro package alone.


Before you begin

Check Ubuntu version shows 22.04 before you use ubuntu2204 URLs. You need a CUDA-capable NVIDIA GPU for runtime tests; toolkit-only installs on CPU hosts are mainly for cross-compilation.

Install headers for DKMS driver builds:

bash
sudo apt install linux-headers-$(uname -r)

WSL2: Follow NVIDIA’s CUDA on WSL—the Windows host carries the driver.


Quick answer

On amd64, download NVIDIA’s keyring for Jammy:

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

Register the repository signing key:

bash
sudo dpkg -i cuda-keyring_1.1-1_all.deb

Refresh indexes so apt sees developer.download.nvidia.com:

bash
sudo apt update

Install the toolkit meta-package:

bash
sudo apt install -y cuda-toolkit

Add export PATH=/usr/local/cuda/bin${PATH:+:${PATH}} to ~/.bashrc, reload the shell, then run nvcc --version and nvidia-smi.


GPU and CUDA 13 compatibility

CUDA 13 does not target Maxwell, Pascal, or Volta for offline compilation. Use CUDA 12.x from the toolkit archive when those GPUs must remain in scope.

bash
lspci | grep -i nvidia

Check or install the NVIDIA driver

cuda-toolkit on CUDA 13.4-style packages does not install a driver. Test the stack:

bash
nvidia-smi

If the command is missing, refresh apt:

bash
sudo apt update

List driver candidates:

bash
ubuntu-drivers devices

Install the recommended package:

bash
sudo ubuntu-drivers install

Reboot when you install a driver for the first time:

bash
sudo reboot

Install CUDA from NVIDIA’s ubuntu2204 repository

Check CPU architecture for the download URL:

bash
dpkg --print-architecture
dpkg output NVIDIA repo path segment
amd64 x86_64
arm64 sbsa

Download the keyring (amd64 example):

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

Install the keyring:

bash
sudo dpkg -i cuda-keyring_1.1-1_all.deb

Refresh package lists:

bash
sudo apt update

Install the toolkit:

bash
sudo apt install -y cuda-toolkit

Inspect the candidate version:

bash
apt-cache policy cuda-toolkit

Pin 13.4 when needed:

bash
sudo apt install -y cuda-toolkit-13-4

Optional nvidia-cuda-toolkit from Ubuntu

22.04 multiverse still ships nvidia-cuda-toolkit (~11.5.x on typical mirrors). Treat it as a legacy distro toolchain—not a substitute for NVIDIA’s CUDA 13 repository unless you have a deliberate compatibility requirement.


Set PATH and verify

Add /usr/local/cuda/bin to PATH in ~/.bashrc, source ~/.bashrc, then:

bash
nvcc --version

Compare with:

bash
nvidia-smi

Update and uninstall

Refresh indexes before you pin or upgrade:

bash
sudo apt update

Move to the 13.4 meta-package when you need that minor:

bash
sudo apt install cuda-toolkit-13-4

Remove the toolkit:

bash
sudo apt purge -y cuda-toolkit

Remove the repository keyring when finished:

bash
sudo apt purge -y cuda-keyring

Troubleshooting

Symptom Likely cause Fix
Keyring download fails Wrong LTS in URL Use ubuntu2204 on 22.04
nvcc not found PATH Export /usr/local/cuda/bin
Driver too old for toolkit Version skew Upgrade nvidia-driver-*
Old GPU + CUDA 13 Architecture limit CUDA 12.x toolkit
nvidia-smi fails after install nouveau / Secure Boot See NVIDIA drivers on Ubuntu

Summary

Ubuntu 22.04 gets a current CUDA 13 toolchain from NVIDIA’s ubuntu2204 repository after you install cuda-keyring and cuda-toolkit. Confirm the driver with nvidia-smi before you trust GPU builds—toolkit packages no longer bundle the driver on CUDA 13.4-style meta-packages.

Avoid Jammy’s old nvidia-cuda-toolkit unless you need that pinned generation. For 24.04 or 26.04 paths, use the sibling articles in the intro table.


References


Frequently Asked Questions

What is the best way to install CUDA on Ubuntu 22.04?

Add NVIDIA’s ubuntu2204 cuda-keyring, then sudo apt install cuda-toolkit. That matches how current ranking guides and NVIDIA’s own network-repository steps describe Jammy.

Is nvidia-cuda-toolkit enough for PyTorch or TensorFlow?

Usually no—those stacks expect a recent CUDA 13 (or vendor-pinned) toolkit from NVIDIA’s repository, not the 11.5-era nvidia-cuda-toolkit alone.

Does this work on Ubuntu 22.04 ARM64?

Yes with the sbsa repository path on SBSA hardware—replace x86_64 in the keyring URL after dpkg --print-architecture.

What does nvidia-smi CUDA Version mean?

It is the maximum CUDA version the installed driver supports, not the nvcc toolkit version.

Finished reading?Beta Get the key takeaways in seconds, then ask follow-up questions
Omer Cakmak

Linux Administrator

Highly skilled at managing Debian, Ubuntu, CentOS, Oracle Linux, and Red Hat servers. Proficient in bash scripting, Ansible, and AWX central server management, he handles server operations on OpenStack, KVM, Proxmox, and VMware.

  • Debian
  • Ubuntu
  • Linux
  • Red Hat Enterprise Linux
  • Shell Script
  • System Administration