-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_vm_docker.sh
More file actions
executable file
·92 lines (66 loc) · 3.19 KB
/
setup_vm_docker.sh
File metadata and controls
executable file
·92 lines (66 loc) · 3.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/bash
# =============================================================================
# setup_vm_docker.sh
# =============================================================================
# This script sets up a virtual machine for running benchmarks with Docker and
# IrisBench on Ubuntu. It is intended for use on an Ubuntu VM equipped with
# Nvidia GPUs.
#
# Usage:
# 1. Ensure your VM is running Ubuntu with Nvidia GPUs.
# 2. Execute this script to set up Docker, NVIDIA Docker, and install necessary
# software for IrisBench and Docker benchmarks.
# =============================================================================
##### INSTALL OFFICAL DOCKER #####
echo -e "/n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/nINSTALL OFFICAL DOCKER/n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/n"
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
# Install Docker
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
##### INSTALL docker-nvidia #####
echo -e "/n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/nINSTALL docker-nvidia/n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/n"
# Install NVIDIA Docker (if using NVIDIA GPUs)
sudo apt update
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
&& curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - \
&& 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
export DEBIAN_FRONTEND=noninteractive
sudo apt-get install -y nvidia-docker2
sudo systemctl restart docker
# Restart Docker to apply changes
sudo systemctl start docker-desktop
sudo systemctl enable docker-desktop
##### Add USR to Docker Group #####
echo -e "/n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/nAdd USR to Docker Group/n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/n"
# Add your user to the Docker group
USR=$(whoami)
sudo groupadd docker
sudo usermod -aG docker $USR
# Restart Docker to apply changes
sudo systemctl restart docker
#### INSTALL IrisBench ###
echo -e "/n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/nInstall git, python3-pip, and Venv/n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/n"
# Install Git, Python, and venv
sudo apt-get install -y git
sudo apt-get install -y wget python3-pip
sudo apt-get install -y python3-venv
##### INSTALL NVIDIA DRIVERS #####
echo -e "/n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/nINSTALL NVIDIA DRIVERS/n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/n"
# Install NVIDIA drivers (if needed)
# Ensure the driver is up-to-date for the GPU to achieve maximum performance.
sudo apt install -y nvidia-driver-535
##### REBOOT VM #####
echo -e "/n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/nREBOOT/n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/n"
# Reboot the system to finish setup
sudo reboot