Installing Mastodon on Reclaim Cloud

The following video guide shows you how to install Mastodon on a Reclaim Cloud virtual private server (VPS). This guide assumes you have your VPS spun up in Reclaim Cloud, a domain for your server chosen, a transactional email account setup with Mailgun, as well as cloud storage using Amazon S3. If none of this is true (or makes no sense), I recommend starting with the “Preparing to Install Mastodon on Reclaim Cloud” guide.

Heads up: As you get to the final minute of the tutorial you need to uncomment two additional lines in the nginx default file, be sure to see notes below 

The above video takes you through installing Mastodon from source on a Debian 11.5 VPS, which is well-documented in their own guides. I recommend using that guide as you follow along with the video. That said, there are several moments wherein you will need to deviate from that guide to get Mastodon v4.0.2 running in Reclaim Cloud. Those divergences from their guide will be documented below with time stamps and a brief description:

7:45-8:30 Don’t install Ruby 3.0.3, rather install Ruby 3.0.4. So, replace the commands they suggest with the following two commands:
RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install 3.0.4
rbenv global 3.0.4
8:55-9:30 Run the following two commands to start postgreSQL and Redis:
systemctl start postgresql
systemctl start redis
14:25-21:00 This is the six minutes of the video when I run through the interactive installer to input environment variables, including domain name, AWS’s S3 settings, Mailgun settings, and more. It might be useful to reference this.

23:00-26:40 Editing /etc/nginx/sites-available/mastodon file to update domain from to your domain, in my example There will be four instances you need to replace. After that, which is documented, you need to copy lines 26 and 27 and paste them below, and then  comment out the original lines 26 and 27. or the new lines you copied in, you want to edit them to look like the following:

listen 443;
listen [::]:443;

After you have saved this file, you can go back and delete the default file at /etc/nginx/sites-available/default and rename the mastodon file we just edited to default. Finally, you will need to edit /etc/nginx/nginx.conf at line 60 and change it from:

include /etc/nginx/sites-available/*
include /etc/nginx/sites-available/default

After that, save the file and run the fulling command to restart nginx:

systemctl start nginx

26:50-27:50 Turn off the firewall for the Reclaim Cloud VPS temporarily and add inbound ports 80 and 443. Be sure to turn the firewall back on after running the cerbot commands to get an SSL certificate.

29:00-30:00 Uncomment the two listen 443 lines we commented out earlier at 26 and 27 (they will now be at lines 32 and 33) and remove the lines we added that were directly beneath them, namely

listen 443;
listen [::]:443;

After that you want to comment out the entire listen block from lines 16-29, the block should look like this:

#server {
# server_name;
# root /home/mastodon/live/public;
# location /.well-known/acme-challenge/ { allow all; }
# location / { return 301 https://$host$request_uri; }

# listen [::]:443 ssl ipv6only=on; # managed by Certbot
# listen 443 ssl; # managed by Certbot
# ssl_certificate /etc/letsencrypt/live/; # managed by Certbot
# ssl_certificate_key /etc/letsencrypt/live/; # managed by Certbot
# include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
# ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


Finally, there are two final lines you need to uncomment, lines 43 and 44. I am now realizing I fail to mention these in the video, but I will rectify that now:

ssl_certificate /etc/letsencrypt/live/;
ssl_certificate_key /etc/letsencrypt/live/;

After you make these changes to /etc/nginx/sites-available/default save the file and restart nginx:

systemctl restart nginx

At this point I recommend turning the firewall in the Reclaim Cloud VPS back on, and going to your domain and hopefully revel in Mastodon loading. If that is not the case, no worries, mate, just let me know the issues you run into in the comments below and I’ll try and help.

This entry was posted in Mastodon, reclaim, Reclaim Cloud and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.