5 Minute Server Setup

Last Updated: 11th September 2021

Server Setup

  1. Update: sudo apt update && sudo apt upgrade
  2. Install automatic updates: sudo apt install unattended-upgrades
  3. 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.

  1. Setup SSH Keys

  2. Restart SSH: sudo systemctl restart sshd

  3. Install fail2ban: sudo apt install fail2ban

Install UFW Firewall

  1. Install: sudo apt install ufw
  2. Replace SSH-PORT to your SSH port: sudo ufw allow <SSH-PORT>/tcp
  3. Allow HTTP/s traffic:
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 8443/tcp
  1. Enable Firewall: sudo ufw enable

Setup a sudo user

  1. adduser <USERNAME>
  2. Add user to sudoers sudo adduser <USERNAME> sudo
  3. 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
  1. 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

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.