This repository contains scripts and instructions for setting up NVIDIA CUDA drivers and toolkit on Ubuntu 24.04 systems.
- A computer with an NVIDIA GPU
- Ubuntu 24.04 installed
- Administrative (sudo) privileges
- Internet connection
-
Clone this repository:
git clone https://github.com/phreck/cuda_ubuntu_setup.git cd cuda_ubuntu_setup -
Make the script executable:
chmod +x cuda_setup.sh
-
Run the installation script:
./cuda_setup.sh
-
Follow the on-screen prompts. The script will:
- Update your system
- Download and install NVIDIA CUDA repository keyring
- Install CUDA Toolkit 12.8
- Install CUDA drivers
- Offer to reboot your system (recommended)
If you prefer to install manually, run the following commands:
sudo apt update
sudo apt upgrade
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt-get update
sudo apt-get -y install cuda-toolkit-12-8
sudo apt-get -y install cuda-drivers
sudo apt-get -y install cudaAfter installation and system reboot, verify that CUDA is correctly installed:
# Check NVIDIA driver installation
nvidia-smi
# Check CUDA version
nvcc --versionIf you encounter issues with the NVIDIA driver, you may need to blacklist the Nouveau drivers:
-
Create a file
/etc/modprobe.d/blacklist-nouveau.confwith the following content:blacklist nouveau options nouveau modeset=0 -
Update initramfs and reboot:
sudo update-initramfs -u sudo reboot
If you encounter installation errors, check:
- Your GPU model is supported by CUDA 12.8
- Your internet connection is stable
- You have sufficient disk space available
This project is licensed under the MIT License - see the LICENSE file for details.
Last updated: April 7, 2025