Last Updated: 11th September 2021
Server Setup
- Update:
sudo apt update && sudo apt upgrade
- Install automatic updates:
sudo apt install unattended-upgrades
- Change SSH Port:
sudo nano /etc/ssh/sshd_config
Remove the # infront of Port 22 and then change it (30000-50000 is ideal).
This is security though obsucurity which is not ideal but port 22 just gets abused by bots.
-
Restart SSH:
sudo systemctl restart sshd
-
Install fail2ban:
sudo apt install fail2ban
Install UFW Firewall
- Install:
sudo apt install ufw
- Replace SSH-PORT to your SSH port:
sudo ufw allow <SSH-PORT>/tcp
- Allow HTTP/s traffic:
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 8443/tcp
- Enable Firewall:
sudo ufw enable
Setup a sudo user
adduser <USERNAME>
- Add user to sudoers
sudo adduser <USERNAME> sudo
- Login as the new user
su - <USERNAME>
Install Docker
Offical Docker Install: Ubuntu Debian CentOS Fedora RHEL
The following is for Ubuntu:
1.
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
4.sudo apt-get update
5. sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose