Skip to content

Instantly share code, notes, and snippets.

@bresilla
Last active June 18, 2025 13:30
Show Gist options
  • Save bresilla/2c20ad57c69b879919f0dfceebfc36b6 to your computer and use it in GitHub Desktop.
Save bresilla/2c20ad57c69b879919f0dfceebfc36b6 to your computer and use it in GitHub Desktop.

Revisions

  1. bresilla revised this gist Jun 18, 2025. 1 changed file with 9 additions and 4 deletions.
    13 changes: 9 additions & 4 deletions cuda.sh
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,18 @@
    #!/bin/bash

    version=ubuntu2404
    # Default to Ubuntu 24.04
    version="ubuntu2404"

    #get ubuntu from /etc/os-release
    # Get Ubuntu version from /etc/os-release
    . /etc/os-release
    if [ "VERSION_ID=22.04" ]; then
    version=ubuntu2204

    # Check for Ubuntu 22.04
    if [ "$VERSION_ID" = "22.04" ]; then
    version="ubuntu2204"
    fi

    echo "Detected Ubuntu version: $VERSION_ID, using package version: $version"

    wget https://developer.download.nvidia.com/compute/cuda/repos/$version/x86_64/cuda-$version.pin
    sudo mv cuda-$version.pin /etc/apt/preferences.d/cuda-repository-pin-600
    wget https://developer.download.nvidia.com/compute/cuda/12.9.1/local_installers/cuda-repo-$version-12-9-local_12.9.1-575.57.08-1_amd64.deb
  2. bresilla created this gist Jun 18, 2025.
    26 changes: 26 additions & 0 deletions cuda.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    #!/bin/bash

    version=ubuntu2404

    #get ubuntu from /etc/os-release
    . /etc/os-release
    if [ "VERSION_ID=22.04" ]; then
    version=ubuntu2204
    fi

    wget https://developer.download.nvidia.com/compute/cuda/repos/$version/x86_64/cuda-$version.pin
    sudo mv cuda-$version.pin /etc/apt/preferences.d/cuda-repository-pin-600
    wget https://developer.download.nvidia.com/compute/cuda/12.9.1/local_installers/cuda-repo-$version-12-9-local_12.9.1-575.57.08-1_amd64.deb

    sudo dpkg -i cuda-repo-$version-12-9-local_12.9.1-575.57.08-1_amd64.deb
    sudo cp /var/cuda-repo-$version-12-9-local/cuda-*-keyring.gpg /usr/share/keyrings/


    wget https://developer.download.nvidia.com/compute/cudnn/9.10.2/local_installers/cudnn-local-repo-$version-9.10.2_1.0-1_amd64.deb
    sudo dpkg -i cudnn-local-repo-$version-9.10.2_1.0-1_amd64.deb
    sudo cp /var/cudnn-local-repo-$version-9.10.2/cudnn-*-keyring.gpg /usr/share/keyrings/


    sudo apt-get update
    sudo apt-get -y install cuda-toolkit-12-9
    sudo apt-get -y install cudnn-cuda-12