Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save niklasschmitz/391e916cdfd2f94d8370975d51426107 to your computer and use it in GitHub Desktop.
Save niklasschmitz/391e916cdfd2f94d8370975d51426107 to your computer and use it in GitHub Desktop.
Install CUDA, Docker, and Nvidia Docker on a new Paperspace GPU machine with Ubuntu 18.04
#!/bin/bash
# 1. Install CUDA
echo "Installing CUDA..."
# Only install if CUDA is not already installed.
if ! sudo dpkg-query -W cuda; then
# The 18.04 installer
sudo curl -O http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
sudo dpkg -i ./cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
sudo apt-get update
sudo apt-get install cuda -y
fi
# 2. Install Docker-CE
echo "Installing Docker-CE..."
# install packages to allow apt to use a repository over HTTPS:
sudo apt-get -y install \
apt-transport-https ca-certificates curl software-properties-common
# add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# set up the Docker stable repository.
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
# update the apt package index:
sudo apt-get -y update
# finally, install docker
sudo apt-get -y install docker-ce
# 3. Install Nvidia-docker
echo "Installing Nvidia-docker..."
wget https://github.com/NVIDIA/nvidia-docker/releases/download/v1.0.1/nvidia-docker_1.0.1-1_amd64.deb
sudo dpkg -i nvidia-docker*.deb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment