2024-07-15 16:30:25 +02:00
|
|
|
Pepare the Ubuntu VM:
|
|
|
|
|
2024-07-13 15:44:22 +02:00
|
|
|
```
|
|
|
|
apt update
|
|
|
|
apt upgrade
|
2024-04-08 10:55:22 +02:00
|
|
|
|
2024-07-13 15:44:22 +02:00
|
|
|
apt install git pkg-config libssl-dev curl mc argon2 ca-certificates net-tools
|
2024-04-08 10:58:43 +02:00
|
|
|
|
2024-07-13 15:44:22 +02:00
|
|
|
install -m 0755 -d /etc/apt/keyrings
|
2024-04-08 10:55:22 +02:00
|
|
|
|
2024-07-13 15:44:22 +02:00
|
|
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
|
2024-04-08 10:55:22 +02:00
|
|
|
|
2024-07-13 15:44:22 +02:00
|
|
|
chmod a+r /etc/apt/keyrings/docker.asc
|
2024-04-08 10:55:22 +02:00
|
|
|
|
2024-07-13 15:44:22 +02:00
|
|
|
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
|
2024-04-08 10:55:22 +02:00
|
|
|
|
2024-07-13 15:44:22 +02:00
|
|
|
apt-get update
|
2024-04-08 10:55:22 +02:00
|
|
|
|
2024-07-13 15:44:22 +02:00
|
|
|
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
2024-04-08 10:55:22 +02:00
|
|
|
|
2024-07-13 15:44:22 +02:00
|
|
|
echo "{" > /etc/docker/daemon.json
|
|
|
|
echo ' "iptables": false' >> /etc/docker/daemon.json
|
|
|
|
echo "}" >> /etc/docker/daemon.json
|
2024-04-08 10:55:22 +02:00
|
|
|
|
2024-07-13 15:44:22 +02:00
|
|
|
systemctl restart docker
|
2024-04-08 10:55:22 +02:00
|
|
|
|
2024-07-13 15:57:36 +02:00
|
|
|
sed -i -e 's/DEFAULT_FORWARD_POLICY="DROP"/DEFAULT_FORWARD_POLICY="ACCEPT"/g' /etc/default/ufw
|
|
|
|
ufw reload
|
|
|
|
iptables -t nat -A POSTROUTING ! -o docker0 -s 172.18.0.0/16 -j MASQUERADE
|
|
|
|
|
2024-07-13 15:44:22 +02:00
|
|
|
ufw allow in on docker0
|
|
|
|
ufw route allow in on docker0
|
|
|
|
ufw route allow out on docker0
|
2024-04-08 10:55:22 +02:00
|
|
|
|
2024-07-13 15:44:22 +02:00
|
|
|
ufw allow 22
|
|
|
|
ufw allow 443
|
|
|
|
ufw enable
|
2024-04-08 10:58:43 +02:00
|
|
|
|
2024-07-13 15:44:22 +02:00
|
|
|
ufw status verbose
|
2024-04-08 10:55:22 +02:00
|
|
|
|
2024-07-13 15:44:22 +02:00
|
|
|
docker run hello-world
|
2024-07-16 16:36:24 +02:00
|
|
|
|
|
|
|
# Mail
|
|
|
|
# Add root to the /etc/alias file and add the msmtprc file to /etc
|
|
|
|
apt -y install msmtp msmtp-mta mailutils
|
|
|
|
vi /etc/msmtprc
|
|
|
|
chmod 644 /etc/msmtprc
|
|
|
|
touch /var/log/msmtp.log
|
|
|
|
chmod 666 /var/log/msmtp.log
|
|
|
|
# ln -s /usr/bin/msmtp /usr/sbin/sendmail
|
|
|
|
|
|
|
|
# echo "Test message" | mail -s "Test subject" root
|
|
|
|
```
|
|
|
|
|
|
|
|
Don't forget to set up the cron job for the backup:
|
|
|
|
|
|
|
|
```
|
|
|
|
crontab -e
|
|
|
|
|
|
|
|
0 0 * * * /bin/bash /root/backup/make_backup.sh
|
2024-04-08 10:58:43 +02:00
|
|
|
```
|