Skip to content

Instantly share code, notes, and snippets.

@stamate
Last active July 4, 2017 18:26
Show Gist options
  • Select an option

  • Save stamate/64e1c872406cef7c03bbba37dff21746 to your computer and use it in GitHub Desktop.

Select an option

Save stamate/64e1c872406cef7c03bbba37dff21746 to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "Checking for CUDA and installing."
# Check for CUDA and try to install.
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
## add check for Ubuntu 14
# sudo apt-get update
# $ sudo apt-get install \
# linux-image-extra-$(uname -r) \
# linux-image-extra-virtual
echo "Installing Docker CE 17.03.2~ce-0~ubuntu-xenial."
apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
apt-key fingerprint 0EBFCD88
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
apt-get update
apt-get install docker-ce=17.03.2~ce-0~ubuntu-xenial -y
usermod -aG docker $USER
systemctl enable docker
cho "Installing Nvidia-Docker "
wget -P /tmp https://github.com/NVIDIA/nvidia-docker/releases/download/v1.0.1/nvidia-docker_1.0.1-1_amd64.deb
dpkg -i /tmp/nvidia-docker*.deb && rm /tmp/nvidia-docker*.deb
nvidia-docker run --rm nvidia/cuda nvidia-smi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment