top of page

How to Install CUDA in Ubuntu

  • Writer: Michael Gruner
    Michael Gruner
  • Mar 26
  • 3 min read

Updated: Mar 31

In this guide we will show you how to install CUDA from scratch on a Ubuntu machine. After several installations, we have distilled the multiple instructions in the internet, to what we consider to be the simplest one.


These instructions are for a fresh CUDA installation. If you already have a CUDA installation, this guide may lack steps.
NVIDIA logo
RidgeRun.ai is a NVIDIA preferred partner.

Prerequisites


  1. Make sure you have a compatible GPU and that your system recognizes it. Open a terminal and run:

lspci | grep -i nvidia    

If everything went well, you should see several entries like the following:

04:00.0 VGA compatible controller: NVIDIA Corporation TU104GL [Quadro RTX 5000] (rev a1)

In my example, my GPU is a Quadro RTX 5000. If you want to check if your GPU supports CUDA, check the official list of CUDA supported GPUs.


  1. Check you kernel and Ubuntu version. Run the following:

uname -a && cat /etc/lsb-release

You should get something like:

Linux orion 6.11.0-1008-azure #8~24.04.1-Ubuntu SMP Thu Jan 16 20:08:18 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=24.04
DISTRIB_CODENAME=noble
DISTRIB_DESCRIPTION="Ubuntu 24.04.2 LTS"

Check your architecture, kernel version and Ubuntu version. In my example:

  • Architecture: x86_64

  • Kernel version: 6.11.0-1008-azure

  • OS version: 24.04


Using the following table, verify your system is supported:

Architecture

Distribution

Kernel Version

x86_64

Ubuntu 24.04.z (z <= 1) LTS

>= 6.8.0-41

x86_64

Ubuntu 22.04.z (z <= 5) LTS

>= 6.5.0-45

x86_64

Ubuntu 20.04.z (z <= 6) LTS

>= 5.15.0-67

Arm64

Ubuntu 24.04.z (z <= 1) LTS

>= 6.8.0-31

Arm64

Ubuntu 22.04 LTS (z <= 5) LTS

>= 6.5.0-1019

Arm64

Ubuntu 20.04.z (z <= 5) LTS

>= 5.4.0-174

  1. Check for a valid GCC installation. Run:

sudo apt install gcc

And then verify the version:

gcc --version
gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0

It must be a version between 6.x and 14.x

Install CUDA

1. Install CUDA APT packages by running:

where <distro>/<arch> should be replaced by one of the following:

  • ubuntu2004/arm64

  • ubuntu2004/sbsa

  • ubuntu2004/x86_64

  • ubuntu2204/sbsa

  • ubuntu2204/x86_64

  • ubuntu2404/sbsa

  • ubuntu2404/x86_64


Update the APT repository cache:

sudo apt-get update

  1. Install CUDA by running:

sudo apt-get install cuda-toolkit

This will take several minutes and can be a very heavy download!


  1. Reboot your system!

sudo reboot

This will install CUDA drivers. There's no need to install them separately.

Install CUDA Utilities

  1. The commands above installed the drivers along with CUDA. Check the installed driver version by running:

dpkg -l | grep -E 'nvidia'

You should see several lines like:


ii  linux-modules-nvidia-570-server-open-6.11.0-1008-azure 6.11.0-1008.8~24.04.1+1                 amd64        Linux kernel nvidia modules for version 6.11.0-1008

You are interested in the 570 number, which is the driver version.


  1. Install the utils by running

sudo apt install nvidia-utils-570
  1. Test proper installation by running nvidia-smi (apologies for the horrible format, but Wix doesn't make it easy :S ):

Wed Mar 26 04:57:37 2025
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 570.86.15              Driver Version: 570.86.15      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  Quadro RTX 5000                Off |   00000000:04:00.0 Off |                  Off |
| 33%   35C    P0             50W /  230W |       1MiB /  16384MiB |      8%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
|   1  Quadro RTX 5000                Off |   00000000:65:00.0 Off |                  Off |
| 34%   36C    P0             40W /  230W |       1MiB /  16384MiB |      2%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI              PID   Type   Process name                        GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|  No running processes found                                                             |
+-----------------------------------------------------------------------------------------+

If you see that, you're on good track!


Post Installation Steps

Append the following lines to your ~/.bashrc (or whatever shell you are using):

export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}

Need Help?

RidgeRun.ai offers CUDA and Deep Learning consulting services. Contact us at support@ridgerun.ai with your inquiry!

Comments


bottom of page