Skip to content

Instantly share code, notes, and snippets.

@dte
Created July 19, 2017 20:56
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save dte/8954e405590a360614dcc6acdb7baa74 to your computer and use it in GitHub Desktop.
Save dte/8954e405590a360614dcc6acdb7baa74 to your computer and use it in GitHub Desktop.
Install CUDA, Docker, and Nvidia Docker on a new Paperspace GPU machine
#!/bin/bash
# 1. Install CUDA
echo "Installing CUDA..."
# Only install if CUDA is not already installed.
if ! dpkg-query -W cuda; then
# The 16.04 installer works with 16.10.
curl -O http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
dpkg -i ./cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
apt-get update
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