Skip to content

Instantly share code, notes, and snippets.

@maxbaluev
Last active January 9, 2020 19:54
Show Gist options
  • Save maxbaluev/c03b98672be3e34a72076ed3045c8209 to your computer and use it in GitHub Desktop.
Save maxbaluev/c03b98672be3e34a72076ed3045c8209 to your computer and use it in GitHub Desktop.
Install cuda 10.1 and nvidia-docker on ubuntu 16.04
# remove cuda if exist
sudo apt-get purge nvidia*
sudo apt-get autoremove
sudo apt-get autoclean
sudo rm -rf /usr/local/cuda*
# install cuda dependencies
sudo apt-get update
sudo apt install build-essential
# install cuda
curl -OL https://developer.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.105_418.39_linux.run
sudo chmod +x cuda_10.1.105_418.39_linux.run
sudo ./cuda_10.1.105_418.39_linux.run --silent
# add PATH and LD_LIBRARY_PATH
echo 'export PATH="/usr/local/cuda-10.1:$PATH" && export LD_LIBRARY_PATH="/usr/local/cuda-10.1/lib64:$LD_LIBRARY_PATH"' >> ~/.bashrc
# install docker
wget -O - https://releases.rancher.com/install-docker/19.03.sh | bash
# install nvidia-container-toolkit
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit
# restart docker
sudo systemctl restart docker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment