How to Install NVIDIA CUDA on Ubuntu 24.04

Deepak Prasad
Tested on Ubuntu 24.04 LTS (Noble Numbat), x86_64 — NVIDIA ubuntu2404 repository and apt package layout (no CUDA-capable GPU on lab host)
Package NVIDIA repo cuda-toolkit 13.4.3-1 (ubuntu2404)
Ubuntu multiverse nvidia-cuda-toolkit (~12.0.x)
Applies to Ubuntu 24.04 LTS (amd64 and arm64 SBSA use the matching repo arch)
Privilege sudo for drivers and packages
Scope Install CUDA Toolkit on Ubuntu 24.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 22.04
Install NVIDIA drivers on Ubuntu
Check Ubuntu version
NOTE
Ubuntu 26.04? Noble does not ship the archive cuda-toolkit meta-package that 26.04 adds in multiverse. On 26.04, see Install CUDA on Ubuntu 26.04 for Ubuntu-managed and NVIDIA-repository options.
Short on time?Beta Get the gist of this 6-minute read in seconds, then ask follow-up questions

CUDA is NVIDIA’s platform for GPU computing. On Ubuntu 24.04 you need a working proprietary NVIDIA driver plus the CUDA Toolkit (nvcc, headers, and libraries). NVIDIA qualifies 24.04 in the CUDA Linux installation guide under the repository codename ubuntu2404.

This page walks through NVIDIA’s recommended network repository install (cuda-keyring + cuda-toolkit). Ubuntu’s older multiverse package nvidia-cuda-toolkit remains if you deliberately want a distro-pinned 12.0-era toolchain instead of current CUDA 13.


Before you begin

Confirm the release with check Ubuntu version — you should see 24.04 before you download ubuntu2404 packages. You need a CUDA-capable NVIDIA GPU on bare metal or supported passthrough; CPU-only hosts can install toolkit packages for cross-builds, but nvidia-smi and device kernels need hardware.

Install kernel headers before driver DKMS builds:

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

WSL2: Use NVIDIA’s CUDA on WSL guide—install the Windows driver on the host, not inside the Linux guest alone.


Quick answer

Add NVIDIA’s CUDA repository, install cuda-toolkit, and put /usr/local/cuda/bin on your PATH:

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

Register the keyring:

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

Refresh indexes:

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, run source ~/.bashrc, then check nvcc --version and nvidia-smi.


Does your GPU support CUDA 13?

CUDA 13 dropped offline compilation support for Maxwell, Pascal, and Volta. Turing and newer (RTX 20xx and later, recent data-center GPUs) fit the CUDA 13 workflow on this page. Older silicon should use CUDA 12.x from NVIDIA’s toolkit archive.

List visible NVIDIA devices:

bash
lspci | grep -i nvidia

No output usually means the OS does not see an NVIDIA PCI device.


Check or install the NVIDIA driver

From CUDA 13.4 packaging, cuda-toolkit does not install the NVIDIA driver. Verify the driver first:

bash
nvidia-smi

When this prints GPU name, driver version, and a process table, skip driver reinstall unless you need a newer branch for your toolkit.

If nvidia-smi is missing, refresh apt and list recommendations:

bash
sudo apt update

Ubuntu’s driver helper lists recommended branches for your hardware:

bash
ubuntu-drivers devices

Install Ubuntu’s recommended branch (example output may show nvidia-driver-580):

bash
sudo ubuntu-drivers install

Reboot after a first driver install:

bash
sudo reboot
Source Meaning
nvidia-smi → CUDA Version Highest CUDA version the driver supports—not the installed toolkit
nvcc --version Installed CUDA Toolkit compiler version

Install CUDA from NVIDIA’s ubuntu2404 repository

NVIDIA documents network repository setup in the CUDA installation guide — Ubuntu. Map architecture before you download the keyring:

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

On amd64, fetch the keyring with the wget command:

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

Install it with dpkg:

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

Update apt:

bash
sudo apt update

Install the rolling toolkit meta-package:

bash
sudo apt install -y cuda-toolkit

See which version apt will take:

bash
apt-cache policy cuda-toolkit
output
Candidate: 13.4.3-1
 13.4.3-1 600
        600 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64  Packages

Pin CUDA 13.4 when frameworks expect that minor:

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

NVIDIA installs under /usr/local/cuda-<version>/ with a symlink at /usr/local/cuda.


Optional Ubuntu multiverse nvidia-cuda-toolkit

Ubuntu 24.04 still publishes nvidia-cuda-toolkit in multiverse (roughly 12.0.x—check apt-cache policy nvidia-cuda-toolkit on your host). Use it only when you need Ubuntu’s pinned distro build instead of NVIDIA’s CUDA 13 line. Do not mix conflicting meta-packages without a deliberate purge plan.


Set the CUDA PATH

Append toolkit binaries to your user PATH:

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

Reload the shell:

bash
source ~/.bashrc

Confirm the default symlink:

bash
ls -l /usr/local/cuda

Verify the CUDA toolkit

Print the compiler version:

bash
nvcc --version
output
nvcc: NVIDIA (R) Cuda compiler driver
Cuda compilation tools, release 13.4, V13.4.xxx

Exact V13.4.* build strings change with package updates.

Compare driver support:

bash
nvidia-smi

The CUDA version line in nvidia-smi should meet the minimum for your toolkit major—see CUDA release notes.


Compile a small CUDA test (GPU required)

Install a C++ toolchain:

bash
sudo apt install -y build-essential

Save a minimal vector_add.cu (same pattern as NVIDIA’s getting-started samples), compile with nvcc -o vector_add vector_add.cu, and run ./vector_add on a host where nvidia-smi already works. Expect output similar to Sample z[0] = 3.000000 when the driver and toolkit align.


Update, pin, or remove CUDA

Refresh and upgrade the meta-package you use:

bash
sudo apt update

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

bash
sudo apt install cuda-toolkit-13-4

List installed CUDA packages:

bash
dpkg -l | grep -E '^ii\s+cuda'

Remove the toolkit meta-package when uninstalling:

bash
sudo apt purge -y cuda-toolkit

Purge cuda-keyring if you no longer want NVIDIA’s repository:

bash
sudo apt purge -y cuda-keyring

Purging cuda-toolkit does not remove nvidia-driver-* on CUDA 13.4-style packaging.


Troubleshooting

Symptom Likely cause Fix
cuda-keyring 404 Wrong release in URL Use ubuntu2404, not ubuntu2204 or ubuntu2604
Wrong architecture in URL arm64 vs amd64 dpkg --print-architecture → sbsa vs x86_64
nvcc: command not found PATH Add /usr/local/cuda/bin; open a new shell
nvidia-smi OK, no nvcc Toolkit missing sudo apt install cuda-toolkit
Driver CUDA below toolkit needs Old driver Upgrade via ubuntu-drivers
CUDA 13 build on old GPU Maxwell/Pascal/Volta Install CUDA 12.x generation
VM with no GPU No device Bare metal or GPU instance

Summary

Ubuntu 24.04 installs current CUDA 13 through NVIDIA’s ubuntu2404 network repository: cuda-keyring, sudo apt install cuda-toolkit, then set PATH and verify with nvcc --version. Install or confirm the NVIDIA driver separately—cuda-toolkit does not pull a driver on CUDA 13.4-style packages.

Use cuda-toolkit-13-4 when you need a fixed 13.4 minor; use Ubuntu’s nvidia-cuda-toolkit only when you intentionally want the older multiverse toolchain. For 26.04 archive installs or 22.04 repo paths, see the sibling guides linked in the intro table.


References


Frequently Asked Questions

How do I install CUDA on Ubuntu 24.04?

Add NVIDIA’s ubuntu2404 cuda-keyring, run sudo apt update, then sudo apt install cuda-toolkit. Set PATH to include /usr/local/cuda/bin.

Should I use nvidia-cuda-toolkit or cuda-toolkit on 24.04?

Use NVIDIA’s cuda-toolkit from the ubuntu2404 repository for CUDA 13. Use Ubuntu nvidia-cuda-toolkit only when you need the distro’s older multiverse build.

Does CUDA 13 work on Ubuntu 22.04?

Yes. NVIDIA publishes a ubuntu2204 repository for Jammy. This article is 24.04 only—the intro table links the 22.04 guide.

What is the difference between nvidia-smi and nvcc?

nvidia-smi reports driver and GPU status plus the highest CUDA version the driver supports. nvcc reports the installed toolkit compiler 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