So, you wanted to run a Mastodon instance? Pre-Installation, hardening the server (Part 1)

Hardening

If you are using VPS (Virtual Private Server), I recommend using VPS for your Mastodon install, as it will allow it to be easily scaled up as needed. So before actually installing anything on that VPS, I highly recommend Hardening the server. Most tutorials out there, do not, or barely cover this step.

Hardening Linux is the act of enhancing the security of the system by introducing proactive measures. In our case, we want to expose SSH, HTTP and HTTPS. So we need Hardening, to prevent malicious activities from being run against our system.

As your server will be exposed on the internet, you will be surprised on how many bots run wild on the internet and do try to access SSH.

Disable root login

First create a user, and add it to the sudo group. For, it's as follows:

adduser steph usermod -aG sudo steph

Now, logout from root and re-login with your new credentials

sudo nano /etc/ssh/sshd_config

Find the line with PermitRootLogin and change it to no

PermitRootLogin no

And restart the service

sudo systemctl restart sshd