Created
May 12, 2025 13:38
-
-
Save robinvanemden/f79e5ffbd72cf02ab5941dcc28a152aa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
echo "[1/5] Updating system..." | |
apt update && apt upgrade -y | |
echo "[2/5] Installing prerequisites..." | |
apt install -y build-essential dkms curl software-properties-common | |
echo "[3/5] Adding NVIDIA CUDA repository..." | |
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-ubuntu2404.pin | |
mv cuda-ubuntu2404.pin /etc/apt/preferences.d/cuda-repository-pin-600 | |
wget https://developer.download.nvidia.com/compute/cuda/12.5.0/local_installers/cuda-repo-ubuntu2404-12-5-local_12.5.0-1_amd64.deb | |
dpkg -i cuda-repo-ubuntu2404-12-5-local_12.5.0-1_amd64.deb | |
cp /var/cuda-repo-ubuntu2404-12-5-local/cuda-*-keyring.gpg /usr/share/keyrings/ | |
apt update | |
echo "[4/5] Installing NVIDIA driver and CUDA..." | |
apt install -y cuda | |
echo "[5/5] Adding CUDA to PATH and LD_LIBRARY_PATH..." | |
echo 'export PATH=/usr/local/cuda/bin:$PATH' >> ~/.bashrc | |
echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc | |
source ~/.bashrc | |
echo "V Installation complete. Reboot to activate NVIDIA driver." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment