Installing NVIDIA Drivers and CUDA on Ubuntu 24.04¶
This guide provides a short tutorial on how to install NVIDIA drivers and CUDA on Ubuntu 24.04 (Noble Numbat).
Prerequisites¶
- An Ubuntu 24.04 system with an NVIDIA graphics card.
- An active internet connection.
- Basic familiarity with the Linux command line.
Steps 1. Install NVIDIA Drivers (if not already installed)¶
Update and Upgrade Package Lists:¶
Install ubuntu-drivers-common:¶
The ubuntu-drivers command is part of the ubuntu-drivers-common package. If you encounter the "command not found" error, install it:
Identify Your NVIDIA Card and Recommended Driver:¶
This command will output information about your NVIDIA card and recommended driver packages. Note the recommended driver version.
Install the Recommended Driver (or a Specific Version):**¶
- Install the recommended driver:
- Or install a specific driver version:
Replace XXX with the desired version.
Reboot Your System:¶
Verify the Installation:¶
Step 2. Install CUDA (Specific Version: 12.8.0)¶
This section details installing CUDA version 12.8.0 using the local .deb repository method.
Download CUDA Repository Pin and Local Installer:¶
wget [https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-ubuntu2404.pin](https://www.google.com/search?q=https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-ubuntu2404.pin)
sudo mv cuda-ubuntu2404.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget [https://developer.download.nvidia.com/compute/cuda/12.8.0/local_installers/cuda-repo-ubuntu2404-12-8-local_12.8.0-570.86.10-1_amd64.deb](https://developer.download.nvidia.com/compute/cuda/12.8.0/local_installers/cuda-repo-ubuntu2404-12-8-local_12.8.0-570.86.10-1_amd64.deb)
Install the CUDA Repository:¶
Add CUDA Repository Key:¶
Update Package Lists and Install CUDA Toolkit:¶
Set Environment Variables:¶
Add the CUDA bin and lib directories to your PATH and LD_LIBRARY_PATH environment variables. Open your ~/.bashrc file with a text editor:
Add the following lines to the end of the file:
export PATH=/usr/local/cuda-12.8/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-12.8/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
Save the file and apply the changes:
Verify the CUDA Installation:¶
Check the CUDA version: