How to Setup a Mastodon Server on Unraid

Learn How To Get Mastodon Setup On An Unraid Server

Share This Post

Mastodon + Unraid

In this tutorial I will show you how to install and setup Mastodon server on Unraid. Mastodon is a decentralized, open-source software that allows users to set up servers to communicate with each other, it is growing in popularity as a “Twitter alternative”. To get started we will need a few things.

  1. Of course we will need an Unraid Server.
  2. The Community Applications plugin for Unraid.
  3. A domain like mydomain.social (Try not to use a sub-domain if possible).
  4. A reverse proxy. We will be using Nginx Proxy Manager for this tutorial.

Ok, Let’s Get Started!

1. First, we need to point our new domain name to our reverse proxy. My domain name is with Domain.com but the process is similar on other platforms. Go to your DNS settings of your domain. I created an “A” record that points to my public IP address where my reverse proxy sits. (Make sure your reverse proxy is port forwarded to the outside through your firewall.)

In the example above I created an “A” record with the “@” for name and pointed it to my public IP where Nginx Proxy Manger sits.

 

2. It’s time to head over to Unraid to download a few apps from Community Applications. First, lets get Redis.

The settings for Redis are pretty easy. We just need to choose a port. I used the default of 6379 but you can change this if you are already using it. Just remember what it is.

3. Now we can download PostgreSQL. Make sure to download the PostgreSQL with NO number after it. (I couldn’t get it to work with those).

For the settings here we need to add a database name, user, and password. I chose mastodon for both the name and user. I also had to choose HOST as the network type to get this to work but your mileage may very. Just test it out.

4. Ok, now it’s time to download Mastodon! Go to the CA store and get it.

There are quite a bit of settings for this one so I have listed them below with some context. But first we need to go to https://randomkeygen.com/ to generate some keys. We need these for the SECRET_KEY_BASE, OTP_SECRET, VAPID_PRIVATE_KEY, and VAPID_PUBLIC_KEY. Once you are on the site scroll down to CodeIgniter Encryption Keys. We will use these 4 keys to fill in the info below. (Don’t use the keys in this example, use your own!)

Network Type : Custom (I used a custom network here so I could set a static IP, also we need ports 80 and 443 which are already taken by Unraid).

Console shell command : Bash

Web UI : 80

Port 443 : 443

Local Domain : Use your domain

Redis Host : Use the local IP of your Unraid server

Redis Port : 6379

DB_Host : Use the local IP of your Unraid server

DB_User : mastodon

DB_Name : mastodon

DB_Pass : The password you created for PostgreSQL

DB_Port : 5432

ES_ENABLED : false (just keep this default)

SECRET_KEY_BASE : Use one of the keys from the website (It does not matter which one).

OTP_SECRET : Use one of the keys from the website.

VAPID_PRIVATE_KEY : Use one of the keys from the website.

VAPID_PUPLIC_KEY : Use one of the keys from the website.

SMTP_SERVER : smtp.gmail.com (I used a gmail account for this. You will need this to send emails to new signups).

SMTP_PORT : 587 (This is gmail’s SMTP port)

SMTP_LOGIN : This is usually your email address or username

SMTP_PASSWORD : Your password to your SMTP server

SMTP_FROM_ADDRESS : Your email again.

S3 ENABLED : false (Keep this default)

WEB_DOMAIN : Your domain again (If you used a subdomain then this needs to be the address WITHOUT the sub part ex. mydomain.com NOT sub.mydomain.com).

ES_HOST : es (Keep this default)

ES_PORT : 9200 (Keep this default)

ES_USER : elastic (Keep this default)

ES_PASS : (Keep this default)

S3_BUCKET : blank (Keep this default)

AWS_SECRET_ACCESS_KEY : blank (Keep this default)

S3_ALIAS_HOST : blank (Keep this default)

At the bottom you will see that I added a Variable for selecting my language. This is optional but good for people coming to your server and knowing what language you support. To do this click on “Add another Path, Port, Variable, Label, or Device”. This will show a pop-up.

Config Type : Variable

Name : DEFAULT_LOCALE

Key : DEFAULT_LOCALE

Value: en (This is for English)

Default Value: en (Again, for English)

Description: Default Language Used By The Server

5. Now it’s time to tell our reverse proxy where Mastodon is and connect it to our domain name. Since Im using Nginx Proxy Manager (NPM) I will be going to the IP address of my instance. Once I’m in NPM Lets add a new host by clicking the “Add Proxy Host” button in the top right.

Now fill in the info.

Domain Names : Use your domain

Scheme : http

Forward Hostname/IP : Local IP you used for Mastodon

Forward Port : 80
Make sure to check both “Block Common Exploits” and “Websocket Support”.

Now go to the “SSL” tab and use the following:

SSL Certificate : Choose “Request A New SSL Certificate With Let’s Encrypt”
Note : Do NOT tick “Force SSL”. Mastodon will do this on its own.

6. If you haven’t already done so, go ahead and start both Redis and PostgreSQL. Wait a few seconds and start Mastodon. (Before you go running to see if Mastodon works wait about a minute for Mastodon to start up).

7. Now you can head over to your new Mastodon server. In my case, I used https://thenucleus.social but you use your domain.

First we need to create an account. (We will later turn this account into an Admin). Click “Create account”.

Let’s create our first account that will later become the admin account.

If you setup your e-mail settings properly this should send you a confirmation link to your e-mail address. Login to your e-mail and confirm the registration.


8. Now lets add our new user as an Admin!

Go back to your Unraid server and click on the “Terminal” button to bring up our command prompt. We need to type the following command:

				
					docker exec -it -w /app/www mastodon bin/tootctl accounts modify MyUsername --role Admin
				
			

Put the username you just created on Mastodon in the last step where “MyUsername” is. Note : Make sure the “Admin” at the end of the command is capitalised. Do NOT use “admin”. This will not work!

And that’s it! You now have your own Mastodon server on Unraid! Feel free to go back to your account and check out the server settings in Mastodon under “Administration”.

If you need some guidance on how to start following people and getting feeds on your new Mastodon server check out this post at masto.host that talks about first steps after installing a Mastodon server. https://masto.host/mastodon-server-first-steps/

You can follow me on Mastodon at:

@ryan@thenucleus.social

Subscribe To Our Newsletter

Get updates and learn from the best

More To Explore