1. Verify CUDA-Capable GPU:
lspci | grep -i nvidia
The output should be similar to the following:
00:1e.0 3D controller: NVIDIA Corporation TU104GL [Tesla T4] (rev a1)
2. Verify Supported Version of Linux
uname -m && cat /etc/*release
The output should be similar to the following:
x86_64
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=24.04
DISTRIB_CODENAME=noble
DISTRIB_DESCRIPTION=”Ubuntu 24.04.1 LTS”
PRETTY_NAME=”Ubuntu 24.04.1 LTS”
NAME=”Ubuntu”
VERSION_ID=”24.04”
VERSION=”24.04.1 LTS (Noble Numbat)”
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL=”https://www.ubuntu.com/"
SUPPORT_URL=”https://help.ubuntu.com/"
BUG_REPORT_URL=”https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL=”https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo
3. Verify the System Has gcc Installed
gcc --version
The output should be similar to the following:
gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
4. Driver Installer
sudo apt-get install -y nvidia-open
5. CUDA Toolkit Installer
1 | wget https://developer.download.nvidia.com/compute/cuda/12.8.0/local_installers/cuda_12.8.0_570.86.10_linux.run |
The output looks like this, just choose Continue
:
1 | ┌──────────────────────────────────────────────────────────────────────────────┐ |
Accept the EULA:
1 | ┌──────────────────────────────────────────────────────────────────────────────┐ |
Unselect the video driver by pressing the Spacebar while [X] Driver is highlighted:
1 | ┌──────────────────────────────────────────────────────────────────────────────┐ |
Then press the down arrow to Install. Press Enter then wait for installation to complete.
After the installation is complete add the following to the bottom of your ~/.profile
or add it to the /etc/profile.d/cuda.sh
file which you might have to create for all users (global)
1 | # set PATH for cuda 12.8 installation |
6. Reboot the system
sudo reboot
7. Remove Outdated Signing Key: (Optional)
sudo apt-key del 7fa2af80
8. Update the Apt repository cache
sudo apt-get update
9. Install the cuDNN library
These are the installation instructions for Debian 11, Ubuntu 18.04, Ubuntu 20.04, 22.04, and 24.04 users.
Approach 1: Specific for ubuntu1804
- Enable the repository:
1 | echo "deb http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 /" | sudo tee /etc/apt/sources.list.d/cuda_learn.list |
- Install the cuDNN library:
1 | sudo apt install libcudnn8 |
Approach 2:
- Enable the repository:
Where ${OS} is debian11, ubuntu1804, ubuntu2004, ubuntu2204, or ubuntu2404.
1 | wget https://developer.download.nvidia.com/compute/cuda/repos/${OS}/x86_64/cuda-${OS}.pin |
- Install the cuDNN library:
1
2sudo apt-get install libcudnn8=${cudnn_version}-1+${cuda_version}
sudo apt-get install libcudnn8-dev=${cudnn_version}-1+${cuda_version}
Where:
- ${cudnn_version} is 8.9.0.*
- ${cuda_version} is cuda12.1 or cuda11.8
10. Reboot the system
sudo reboot
11. Verifying the Install on Linux
nvcc -V
The output should be similar to the following:
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2025 NVIDIA Corporation
Built on Wed_Jan_15_19:20:09_PST_2025
Cuda compilation tools, release 12.8, V12.8.61
Build cuda_12.8.r12.8/compiler.35404655_0
References: