Created
January 3, 2026 16:21
-
-
Save qingy1337/17e3dd68375388a171ea8b20919c61aa to your computer and use it in GitHub Desktop.
CUDA 12.8 Ubuntu Installation One-shot
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
| # Update package list and install required tools | |
| apt-get update -y | |
| apt-get install -y wget lsb-release | |
| # Auto-detect distro for repo (works for Ubuntu 22.04/24.04) | |
| distribution=$(lsb_release -is | tr '[:upper:]' '[:lower:]') | |
| version=$(lsb_release -rs | sed 's/\.//g') | |
| repo_code="${distribution}${version}" | |
| # Download and set up pinning + keyring | |
| wget https://developer.download.nvidia.com/compute/cuda/repos/${repo_code}/x86_64/cuda-${repo_code}.pin | |
| mv cuda-${repo_code}.pin /etc/apt/preferences.d/cuda-repository-pin-600 | |
| wget https://developer.download.nvidia.com/compute/cuda/repos/${repo_code}/x86_64/cuda-keyring_1.1-1_all.deb | |
| dpkg -i cuda-keyring_1.1-1_all.deb | |
| # Update and install CUDA 12.8 Toolkit specifically (includes nvcc) | |
| apt-get update -y | |
| apt-get install -y cuda-toolkit-12-8 | |
| # Clean up downloaded files (optional) | |
| rm cuda-keyring_1.1-1_all.deb | |
| # Set environment variables for this session (add to ~/.bashrc for persistence) | |
| export PATH=/usr/local/cuda-12.8/bin:$PATH | |
| export LD_LIBRARY_PATH=/usr/local/cuda-12.8/lib64:$LD_LIBRARY_PATH | |
| # Verify installation | |
| nvcc --version |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment