-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFirstRun.sh
executable file
·76 lines (68 loc) · 1.93 KB
/
FirstRun.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
73
74
75
76
#!/bin/bash
# VARIABLES #######################################################
# Packages to install
PACKAGES_TO_INSTALL=(
virtualbox
openssh-server
htop
epiphany-browser
neovim
nodejs
npm
)
# Users
USERS=(
kelvinra
ozorio
diogo
rondon
severiano
james
)
###################################################################
# HANDLING WITH THE SYSTEM ########################################
# Upgrade
sudo apt update
sudo apt upgrade -y
# Installing packages
for package in ${PACKAGES_TO_INSTALL[@]}; do
if ! dpkg -l | grep -q $package; then # Only install if the package isn't on the system
sudo apt install $package -y
else
echo "$package ALREADY INSTALLED"
fi
done
# Installing Docker
# First check if there is a snap package
sudo snap remove docker
# From: https://docs.docker.com/engine/install/ubuntu/ :
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
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 \
"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 apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
# Creating users
for user in ${USERS[@]}; do
sudo adduser $user
sudo usermod -aG sudo $user
done
# Updating NodeJS and npm
sudo npm install -g n
sudo n stable
###################################################################
# FINISHING #######################################################
sudo apt update
sudo apt autoclean
sudo apt autoremove -y
echo "If possible, reboot the server!"
echo "All done! Now configure the static IP."
###################################################################