-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-prereq.sh
executable file
·72 lines (72 loc) · 2.75 KB
/
install-prereq.sh
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
#!/bin/bash
########################################################################
###This script install the prerequisite software for Debian or Ubuntu###
########################################################################
############################ Ubuntu ####################################
sudo apt-get install \
aptitude nano sngrep \
terminator -y
VERSION=$(grep -oP '(?<=^ID=).+' /etc/os-release | tr -d '"')
if [[ $VERSION = "ubuntu" ]]
then
clear
echo "Ubuntu detected"
echo "Installing prerequisite software for Ubuntu"
echo "Uninstall old versions"
sudo apt-get remove docker docker-engine docker.io containerd runc
echo "Updating apt package"
sudo apt-get update
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release -y
echo "Adding Docker´s official GPG key"
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \
sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "Setting up repository"
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo chmod a+r /etc/apt/keyrings/docker.gpg
sudo apt-get update -y
echo "Installing latest version"
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin -y
echo "Complete"
sudo docker run hello-world
elif [[ $VERSION == "debian" ]]
then
############################ Debian ####################################
echo "Debian detected"
echo "Installing prerequisite software for Debian"
echo "Uninstall old versions"
sudo apt-get remove docker docker-engine docker.io containerd runc
echo "Updating apt package"
sudo apt-get update
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release -Y
echo "Adding Docker´s official GPG key"
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | \
sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "Setting up repository"
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
https://download.docker.com/linux/debian \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo chmod a+r /etc/apt/keyrings/docker.gpg
sudo apt-get update -y
echo "Installing latest version"
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo docker run hello-world
else
echo "You are using a distribution different than Ubuntu or Debian, \
please refer to the Docker documentation"
fi
echo "Installing docker compose"
sudo apt-get install docker-compose-plugin