Skip to content

Instantly share code, notes, and snippets.

@vicente-gonzalez-ruiz
Last active February 14, 2024 19:15
Show Gist options
  • Save vicente-gonzalez-ruiz/42801735d0fea2f4e0d22c2e75b2c556 to your computer and use it in GitHub Desktop.
Save vicente-gonzalez-ruiz/42801735d0fea2f4e0d22c2e75b2c556 to your computer and use it in GitHub Desktop.
# See: https://gist.github.com/Mahedi-61/2a2f1579d4271717d421065168ce6a73
# Remove any previous CUDA installation
sudo apt-get purge nvidia*
sudo apt remove nvidia-*
sudo rm /etc/apt/sources.list.d/cuda*
sudo apt-get autoremove && sudo apt-get autoclean
sudo rm -rf /usr/local/cuda*
# Install the required packages
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install g++ freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev
# Add the repo for "vintage" NVIDIA drivers
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
# Install the right driver
sudo apt install libnvidia-common-470
sudo apt install libnvidia-gl-470
sudo apt install nvidia-driver-470
# Install CUDA
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub
sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /"
sudo apt-get update
sudo apt install cuda-11-3
# Setup the paths
echo 'export PATH=/usr/local/cuda-11.3/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-11.3/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc
sudo ldconfig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment