Setting up a Mastodon instance (lab)

5 min readNov 11, 2022

With the great Twitter migration, everyone has been dashing to Mastodon to create accounts and replicate their Twitter experience. Mastodon is decentralized with a federation of hundred of servers that are run by their own admins, moderation rules, and members. Members from different servers can communicate with each other. There are a TON of resources out there on what Mastodon is and how it works.

This post isn’t that. As a lifelong learner, obviously once I learned you can run your own instance, my curiosity peaked and I wanted to figure out how to try this. Some caveats to start with. This was not easy to figure out. I made many mistakes and it took me a while to get things running correctly. Additionally, I did not start an instance to actually run it with a ton of other members. At most, it was to test and run with a few friends on the server. Also, this was not cost-free. As I get into how I accomplished this, I did spend some money on this even though I have multiple test environments, hardware, domains, etc…

Ok, let’s get into it. The first thing I did was grab a new domain. I did not want to use one of my previous domains even though I probably could have. I went with This comes in later when I decided how to deploy my Mastodon instance (using Cloudron) but I went with Namecheap even though most of my domains are on Hover. That is because Namecheap is built into Cloudron’s config and Hover is not.

Next, I had to figure out how to host my Mastodon instance. I tried initially running it on my Unraid box at home because there is a container in the app store for this. However, the deployment config was a bit complicated and there was not a lot of documentation on how to do this. It also meant hosting an app that would have to be open to the internet which probably is asking for trouble. So I abandoned this effort.

That led me down the path to hosting it in the cloud. There are some providers like Digital Ocean that have a 1-click deployment for Mastodon. However, I did not want to pay money right away to test this. Digital Ocean, just like AWS/Azure, requires you to pay to deploy a virtual machine. I did some digging and found a video from a Linode developer who used Cloudron to deploy Mastodon.

Looking into Cloudron, I found it was free to deploy a single app and it can be installed on an Ubuntu server. So using my MSDN credits in Azure, I stood up a 2vCPU, 4GB Ubuntu 20.03 server and installed Cloudron on it. You do need an external IP address. For my Network Security Group, I did have to open 443 to the internet. I also opened SSH but only to my home IP. There are probably better ways to secure this for larger servers but for a small server that’s not open to everyone, this is probably enough for now. Also, once the configuration is done for the server, you could remove SSH completely as it’s not really required unless you need to update the server.

Once it was installed, I deployed Mastodon from the app store. This was a 1-click deployment but one of the things I have found is that it is less customizable. Many of the config files accessed through the terminal are read-only and cannot be modified even using root and chmod. But being 1-click, it was super easy to deploy so there are trade offs. You’ll need access to your DNS provider to configure an A record to point the admin console to

Once that’s done, you can log in using your Cloudron user credentials. You have to assign that user as an admin in order to open up the administration console. In order to do that, open up the settings for Mastodon in the Cloudron portal and find the TINY terminal icon.

The command to add an admin user is:

bin/tootctl accounts modify insertyourusername [-][-]role admin

Once you have that set, you should be able to go through all the admin settings like setting the rules, server icon, moderation, etc…

The final thing you need to set up is email. Again, there are a ton of different ways to do this but for most of us, it will require an SMTP relay. I ended up using Mailjet which is built into Cloudron’s configuration. Because I used my root domain to set up Cloudron, the only way I got it to work was using the root domain for my SMTP settings. I could not get a subdomain to work. Mailjet does have a free option as long as you keep your emails under 200 per day. Grab the API and secret key from the admin console in Mailjet. The API key goes in the username and the secret key goes in the password fields within the Outbound email settings in Cloudron.

The status should be green if you’ve authenticated correctly and you can send a test email. I have my main email set up at Protonmail but you’ll also probably need an email provider where you can send emails from your custom domain.

I know I still have a lot to learn but I mostly wanted to write this to document for myself to refer back to. Hopefully, if you made it this far, this can help you get started!