-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclab-v2.sh
68 lines (52 loc) · 2.16 KB
/
clab-v2.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
# Define ANSI escape codes for blue color
BLUE='\033[0;34m'
NC='\033[0m' # No Color
RED='\033[0;31m'
GREEN='\033[0;32m'
# Display progress in blue
echo -e "${BLUE}Updating package lists...${NC}"
sudo apt update
echo -e "${BLUE}Installing Docker...${NC}"
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install -y ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/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/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update -y
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# Create Docker group if it doesn't exist
if ! getent group docker > /dev/null 2>&1; then
echo -e "${BLUE}Creating Docker group...${NC}"
sudo groupadd docker
fi
# Add the current user to the Docker group
echo -e "${BLUE}Adding the current user to the Docker group...${NC}"
sudo usermod -aG docker $USER
# Display in blue
echo -e "${BLUE}Installing curl and wget...${NC}"
sudo apt install -y curl wget
# Download the Debian package
echo -e "${BLUE}Downloading the Debian package...${NC}"
wget https://bodhitree.cse.iitb.ac.in/clab/clab_1.0.0_amd64.deb
# Install the downloaded Debian package using dpkg
echo -e "${BLUE}Installing the downloaded Debian package...${NC}"
sudo dpkg -i clab_1.0.0_amd64.deb
# Install dependencies (if any)
echo -e "${BLUE}Installing dependencies...${NC}"
sudo apt install -fy
# Cleanup downloaded Debian package
echo -e "${BLUE}Cleaning up...${NC}"
rm clab_1.0.0_amd64.deb
# Enable Docker service
echo -e "${BLUE}Enabling Docker service...${NC}"
sudo systemctl enable docker
# Display completion message
echo -e "${BLUE}Installation complete.${NC}"
# Display instructions to logout and log in again
echo -e "\n\n\n${GREEN}Vlab has been successfully installed.\n\n${RED}Please restart to finish installation.${NC}"