How To Install NVIDIA CUDA on Ubuntu 26.04 LTS

Install NVIDIA CUDA on Ubuntu 26.04

If you want to Install NVIDIA CUDA on Ubuntu 26.04, this guide shows the clean Ubuntu-native way that works on a fresh LTS system. Ubuntu 26.04 now includes CUDA in its official archive, so you can install the toolkit with APT instead of juggling old third-party repo steps. That makes setup easier for developers, sysadmins, and Linux users who want a stable GPU compute stack without extra risk.

Ubuntu 26.04 LTS is the first Ubuntu release to ship the NVIDIA CUDA toolkit in the archive, and Canonical says you can install it directly with sudo apt install cuda-toolkit. NVIDIA’s Linux installation guide still recommends checking for a CUDA-capable GPU, supported Linux version, GCC, and conflicting install methods before you begin. In this article, I will walk you through the full Install NVIDIA CUDA on Ubuntu 26.04 setup, explain what each command does, and show why each step matters so you do not just copy commands blindly.

Prerequisites

Before you start, make sure you have:

  • Ubuntu 26.04 LTS installed and updated.
  • Sudo access for package installation and system changes.
  • An NVIDIA GPU that supports CUDA.
  • A working internet connection.
  • A terminal app such as Ptyxis or your preferred shell.
  • Enough free disk space for the toolkit and driver packages.

Step 1: Check Your GPU

Verify the hardware

lspci | grep -i nvidia

This command checks whether the system can see an NVIDIA device on the PCI bus. That matters because CUDA only works if the machine has NVIDIA hardware that the OS can detect. If you see no result, fix the hardware problem before you move on.

Example output

01:00.0 VGA compatible controller: NVIDIA Corporation GA106 [GeForce RTX 3060]

Why this step matters

You do not want to install drivers and CUDA packages on a machine that cannot see the GPU. NVIDIA’s installation guide also begins with verifying that you have a CUDA-capable GPU and a supported Linux system. This saves time and helps you avoid a broken install path.

Step 2: Update Ubuntu

Refresh package lists

sudo apt update
sudo apt upgrade -y

apt update refreshes the package index from Ubuntu’s repositories. apt upgrade -y then brings your installed packages up to date. Doing this first reduces the chance of dependency conflicts during the CUDA install.

Why this step matters

CUDA installation is much safer on a current system. Ubuntu 26.04 release notes show that CUDA is available directly from the Ubuntu archive, so you want your package lists current before you install it. A stale package index can make APT miss the right version or fail with a dependency error.

Step 3: Install Needed Tools

Install build and kernel packages

sudo apt install build-essential dkms linux-headers-$(uname -r) ca-certificates -y

build-essential gives you GCC and Make tools. dkms helps the NVIDIA kernel module rebuild after kernel updates. linux-headers-$(uname -r) installs the headers for your exact running kernel, which the driver needs to build correctly.

Why this step matters

The NVIDIA guide says to verify GCC and handle prerequisites before installation. If your kernel headers do not match your running kernel, DKMS can fail. If GCC is missing, the driver cannot compile its kernel module.

Step 4: Enable Ubuntu Repositories

Make sure multiverse is enabled

sudo apt install software-properties-common -y
sudo add-apt-repository universe -y
sudo add-apt-repository multiverse -y
sudo apt update

This turns on the repository sections that contain optional and restricted packages. Ubuntu 26.04 places cuda-toolkit in the archive, and the release notes show that users install it from the Ubuntu repositories with APT. Without the right repo components, APT may not find the package.

Confirm the repo

grep -r "multiverse" /etc/apt/sources.list*

Why this step matters

The release notes specifically say the CUDA toolkit is available in Ubuntu’s archive, and the package name is cuda-toolkit. If your repository setup is incomplete, you will not see that package. This is one of the most common setup mistakes on fresh systems.

Step 5: Install CUDA Toolkit

Install the package

sudo apt install cuda-toolkit -y

This installs the CUDA compiler, libraries, and toolkit components from Ubuntu 26.04. Canonical’s release notes give this exact command for Ubuntu 26.04. You do not need the old NVIDIA repo setup for this release.

Check what APT selected

apt-cache policy cuda-toolkit

Example output

cuda-toolkit:
  Installed: 13.1.1-0ubuntu1
  Candidate: 13.1.1-0ubuntu1
  Version table:
     13.1.1-0ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu resolute/multiverse amd64 Packages

Why this step matters

This is the heart of the Install NVIDIA CUDA on Ubuntu 26.04 process. Ubuntu 26.04 is the first Ubuntu LTS to make CUDA available in its official archive, which is a big change from older versions. That gives you a cleaner install path and fewer third-party repo problems.

Step 6: Install the NVIDIA Driver

Use Ubuntu’s driver picker

sudo ubuntu-drivers autoinstall

This tells Ubuntu to detect your GPU and install the recommended NVIDIA driver. On many systems, this is the safest choice because it aligns the driver with your hardware and current kernel.

Reboot after install

sudo reboot

Verify the driver

After reboot, run:

nvidia-smi

Example output

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 570.xx    Driver Version: 570.xx    CUDA Version: 13.1         |
+-----------------------------------------------------------------------------+

Why this step matters

CUDA needs both the toolkit and a working driver. NVIDIA’s Linux guide separates toolkit setup from driver installation for a reason. The driver talks to the GPU, while the toolkit gives you nvcc and the development libraries.

Step 7: Configure CUDA Paths

Add CUDA to PATH

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

This adds CUDA binaries and shared libraries to your shell environment. PATH lets you run nvcc from anywhere. LD_LIBRARY_PATH helps programs find CUDA libraries at runtime.

Check the variables

echo $PATH | grep cuda
echo $LD_LIBRARY_PATH | grep cuda

Why this step matters

Without these paths, the toolkit may be installed but not usable from your shell. NVIDIA’s guide also includes post-install environment setup as a required step. This is one of those details that makes the difference between “installed” and “actually ready.”

Step 8: Verify CUDA Works

Check the compiler

nvcc --version

Example output

nvcc: NVIDIA (R) Cuda compiler driver
Cuda compilation tools, release 13.1

Check the driver again

nvidia-smi

Why this step matters

nvcc confirms that the toolkit is installed and visible in your shell. nvidia-smi confirms that the driver is alive and the GPU is accessible. You want both before you move on to ML frameworks, CUDA samples, or custom builds.

How To Install NVIDIA CUDA on Ubuntu 26.04 in a Clean Workflow

Clean summary of the flow

  1. Confirm the GPU is detected.
  2. Update Ubuntu.
  3. Install build dependencies and headers.
  4. Enable the needed repositories.
  5. Install cuda-toolkit.
  6. Install or confirm the NVIDIA driver.
  7. Set environment variables.
  8. Verify with nvcc and nvidia-smi.

Why this workflow works

This workflow follows the structure of NVIDIA’s official Linux installation guide and Ubuntu 26.04’s new packaging model. It keeps the install simple and avoids mixing old repository methods with Ubuntu’s native archive package. That matters for stability on desktops, workstations, and servers.

Common Mistakes to Avoid

Do not mix install methods

Do not combine Ubuntu archive packages with old runfile-based installs unless you know exactly why. NVIDIA warns about conflicting installation methods in its Linux guide. Mixed installs often create broken libraries and driver conflicts.

Do not skip reboot

The NVIDIA driver usually needs a reboot before nvidia-smi works. The kernel module must load cleanly after installation. Skipping reboot often leads to false failure reports.

Do not ignore kernel headers

If the driver build fails, check linux-headers-$(uname -r) first. This package must match your running kernel. Missing headers are a common reason the NVIDIA module does not compile.

Troubleshooting

1. cuda-toolkit not found

If APT cannot find the package, run:

sudo add-apt-repository multiverse -y
sudo apt update

This usually means the repository component is missing. Ubuntu 26.04 provides CUDA through its archive, so APT must know where to look.

2. nvcc: command not found

Check your shell path:

echo $PATH
command -v nvcc

If needed, re-run the PATH export commands and load ~/.bashrc again. This error usually means the toolkit is installed but your shell cannot find it.

3. nvidia-smi fails

Check whether the driver loaded:

lsmod | grep nvidia

If nothing appears, reinstall the driver and reboot. The GPU driver must be active before CUDA workloads can run.

4. DKMS build failure

Check headers and logs:

dkms status
uname -r

Then reinstall the matching headers package. NVIDIA’s guide expects a supported Linux version and correct build tools before installation. A kernel mismatch is often the real cause.

5. Secure Boot blocks the driver

If Secure Boot is enabled, the kernel may block unsigned NVIDIA modules. In that case, either enroll a MOK key or disable Secure Boot in firmware. This issue shows up often on modern UEFI systems.

r00t is a Linux Systems Administrator and open-source advocate with over ten years of hands-on experience in server infrastructure, system hardening, and performance tuning. Having worked across distributions such as Debian, Arch, RHEL, and Ubuntu, he brings real-world depth to every article published on this blog. r00t writes to bridge the gap between complex sysadmin concepts and practical, everyday application — whether you are configuring your first server or optimizing a production environment. Based in New York, US, he is a firm believer that knowledge, like open-source software, is best when shared freely.

Related Posts