#!/bin.bash
set -e
# More details on other OS in https://cloud.google.com/compute/docs/gpus/install-drivers-gpu
# install docker
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update -y
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
sudo systemctl start docker
sudo systemctl enable docker
# add user to docker group
sudo usermod -aG docker $USER
# install NVIDIA drivers
sudo apt install -y linux-headers-$(uname -r)
curl -O 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 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /"
sudo apt update
sudo apt -y install cuda
sudo nvidia-smi
#install nvidia docker
curl -fsSL https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
curl -s -L https://nvidia.github.io/nvidia-docker/$(. /etc/os-release;echo $ID$VERSION_ID)/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt-get update -y
sudo apt-get install -y nvidia-docker2
sudo systemctl restart docker
# Load Drivers
modprobe nvidia
Last active
July 16, 2021 17:50
-
-
Save akaanirban/ea1231f80adf02a199e373f122a70a61 to your computer and use it in GitHub Desktop.
Setup script to configure a (GCP/AWS) Ubuntu VM with NVIDIA drivers and NVIDIA docker container toolkit.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment