Skip to content

Instantly share code, notes, and snippets.

@tarun-ssharma
Forked from fo40225/ubuntu1804cuda10.sh
Created May 9, 2022 06:19
Show Gist options
  • Save tarun-ssharma/5b1b4a0d859c7a30d91a98c56f042b86 to your computer and use it in GitHub Desktop.
Save tarun-ssharma/5b1b4a0d859c7a30d91a98c56f042b86 to your computer and use it in GitHub Desktop.
install cuda 10 on ubuntu 18.04
# echo "blacklist nouveau" | sudo tee -a /etc/modprobe.d/blacklist-nouveau.conf > /dev/null
# echo "options nouveau modeset=0" | sudo tee -a /etc/modprobe.d/blacklist-nouveau.conf > /dev/null
# sudo update-initramfs -u
sudo apt update
sudo apt -y install build-essential
sudo apt update
sudo apt -y install linux-headers-$(uname -r)
wget https://developer.nvidia.com/compute/cuda/10.0/Prod/local_installers/cuda-repo-ubuntu1804-10-0-local-10.0.130-410.48_1.0-1_amd64
sudo dpkg -i cuda-repo-ubuntu1804-10-0-local-10.0.130-410.48_1.0-1_amd64
sudo apt-key add /var/cuda-repo-10-0-local-10.0.130-410.48/7fa2af80.pub
sudo apt update
sudo apt -y install cuda-10-0
echo "export PATH=\"/usr/local/cuda-10.0/bin:\$PATH\"" >> ~/.bashrc
wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/libcudnn7_7.6.0.64-1+cuda10.0_amd64.deb
wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/libcudnn7-dev_7.6.0.64-1+cuda10.0_amd64.deb
sudo dpkg -i libcudnn7_7.6.0.64-1+cuda10.0_amd64.deb
sudo dpkg -i libcudnn7-dev_7.6.0.64-1+cuda10.0_amd64.deb
sudo apt update
sudo apt -y install libcudnn7=7.6.0.64-1+cuda10.0 libcudnn7-dev=7.6.0.64-1+cuda10.0
wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/libnccl2_2.4.7-1+cuda10.0_amd64.deb
wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/libnccl-dev_2.4.7-1+cuda10.0_amd64.deb
sudo dpkg -i libnccl2_2.4.7-1+cuda10.0_amd64.deb
sudo dpkg -i libnccl-dev_2.4.7-1+cuda10.0_amd64.deb
sudo apt update
sudo apt -y install libnccl2=2.4.7-1+cuda10.0 libnccl-dev=2.4.7-1+cuda10.0
# https://developer.nvidia.com/rdp/cudnn-download
tar axvf cudnn-10.0-linux-x64-v7.6.0.64.tgz
sudo mv cuda/include/cudnn.h /usr/local/cuda/include
sudo mv cuda/lib64/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
rm -rf cuda
# https://developer.nvidia.com/nccl/nccl-download
tar axvf nccl_2.4.7-1+cuda10.0_x86_64.txz
sudo mkdir /usr/local/cuda/lib
sudo mv nccl_2.4.7-1+cuda10.0_x86_64/include/nccl.h /usr/local/cuda/include
sudo mv nccl_2.4.7-1+cuda10.0_x86_64/lib/libnccl* /usr/local/cuda/lib
sudo chmod a+r /usr/local/cuda/include/nccl.h /usr/local/cuda/lib/libnccl*
rm -rf nccl_2.4.7-1+cuda10.0_x86_64
sudo ldconfig
## if keyboard or mouse loses function after executing this script
## boot into emergency mode and
## sudo apt install -y xserver-xorg-input-all
## update driver only (for newer kernel) use a enough driver version to install
## sudo dpkg -i cuda-repo-ubuntu1804-10-1-local-10.1.243-418.87.00_1.0-1_amd64.deb
## sudo apt install -y cuda-drivers
## online?
## wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
## sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
## sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
## sudo add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /"
## sudo apt-get update
## sudo apt-get -y install cuda-drivers cuda-10-0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment