But, as I’m sure most are aware, Twitter has been a bit of a mess lately. And it’s not somewhere I want to use my energy or spend any time on. But like the rest of my Twitter-addicted friends, I can’t just quit Twitter. I need something to replace it, and right now, it looks like Mastodon is that thing. I technically have had a Mastodon account since 2018 when it first launched, but that sat dormant until a couple of months ago when I signed back in, just in case. Also: Ditching Twitter? Here’s how to get started on Mastodon Mastodon is confusing in that you have to pick a server to join. And each server can have slightly different rules, moderation policies, or even themes. But that also means you can start your own Mastodon server. And so, I decided that if I’m going to truly move away from Twitter, I want to own my entire Mastodon experience. I don’t want to worry about the server I’ve joined having an admin go rogue, or not being able to secure enough funding to keep running. I want to be my own admin, and it’ll be up to me to keep the server running. At first, I tried looking for a hosting provider I could pay a small monthly fee to in exchange for them hosting my Mastodon instance. Unfortunately, it seemed all of those providers have stopped taking new signups because they’re overwhelmed. So I started looking for ways to run a Mastodon server at home. At first I looked into using a Docker container on my Synology NAS, but ultimately decided to repurpose a spare Raspberry Pi 4 I had lying around doing nothing. I had previously used it to run a Pi Hole ad blocker and Homebridge to control non-HomeKit devices using HomeKit. Both of those tasks are now handled by my NAS, and so began the process of trying to install Mastodon on a Pi. Also: How I solved one of my biggest Raspberry Pi headaches Below I’ll walk you through what ended up working for me, linking out to a guide that I followed and providing some pieces of advice for those who also decide to give it a try.
How it’s going so far
Before I cover how to start your own instance, let me just say that after three weeks of having my own Mastodon server, complete with a custom domain name, I have no regrets. There’s something liberating about knowing that I own the entire experience, including all of my data – and it’s all stored in my basement. Once the server was up and running, I was able to use Mastodon just as I had over at Mastodon.social and Journa.host. In fact, I have redirected both accounts to my self-hosted account @mrcippy@mrcippy.xyz. Moving your account from one server to another isn’t a horrible process, but it could be improved (See “How do I move to a different server?”). The transition meant that I kept all of my followers, which showed up in batches over a couple of hours, but had to go back and manually follow everyone I was following before. It took an hour or so for all of my followers to fully transfer over. However, I think if I would have created an archive of my old account – which includes my posts, follows, boosts and likes – I could have imported that information into my account and switching severs wouldn’t have been as much of a hassle. Outside of migrating accounts, the rest of the experience has been hiccup-free. I’ve really been impressed with how fast my timeline loads, including posting photos and videos, even as the number of people I follow continues to climb, increasing what’s loaded in my personal timeline, but also in the local and federated feeds that it creates. The Pi 4, thus far, has been more than capable of running a single-user instance. I’d imagine it’d have no issues running with more than a couple of users, but I wouldn’t push it much further than that.
What you’ll need
A Raspberry Pi 4 with at least 2GB of memory.A microSD card. The bigger, the better. I used a 256GB card. A USB-C power supply for the Raspberry Pi 4.A domain of your own. I bought one using Cloudflare, but you can buy one wherever you want.A few hours set aside to install, troubleshoot, and install again (if needed).
Also: What do all those microSD and SD card numbers and letters mean? Ideally, you have a Raspberry Pi sitting idle that you can repurpose, as I did.
There are a lot of guides, but here’s the one I followed
I’m not smart enough to figure out the steps required to install a Mastodon server on a Pi, so I used a guide. I actually tried a few guides, but the guide on PiMyLifeUp is ultimately the one that worked for me. It’s very long, but thorough and explains each step. After you get Raspbian up and running on your Pi, you can connect to it via SSH and just copy and paste the commands found in the guide. Also: Why a Raspberry Pi 5 in 2023 could be a disaster There’s only one section I didn’t follow, and that’s the Node.JS section. Instead of installing the latest version, which I think is 18.x, I installed the latest version of Node.JS 16. I had some issues with the installation early on and a friend (who was also building his own instance on a Pi) said that Node.JS 18 wouldn’t work. I can’t confirm that, but I can say that using Node.JS 16 did work. So, when you get to the section for installing Node.JS, run these commands instead of following the secondary PiMyLifeUp guide. Once you’re done with that part of the installation, go back to the PiMyLifeUp guide and follow the rest of it. sudo apt install nodejs node -v The entire process takes roughly an hour, maybe 90 minutes, with the Ruby installation taking the most time. Be patient; let the Pi complete each step before moving on to the next.
Dealing with the domain and port forwarding on your home network
The hardest part of the entire installation process was dealing with the domain, security certificates, and port forwarding. I have a basic idea of how to do all of that, but when it comes down to it, I get lost pretty easily. If you’re like me, I suggest reaching out to a friend or even to support at your domain host to get it all sorted. You can’t finish the installation unless the Let’s Encrypt portion of the install finishes without any errors. That also means you need to have bought your domain and figured out a way to point that domain to ports 80 and 443 of your Raspberry Pi on your local network, before you get to the Let’s Encrypt portion of the tutorial. Originally, I used the Firewalla Gold Plus I have installed on my home network and its built-in dynamic DNS feature to point my domain to my home’s IP address. That way whenever Comcast decides to change my IP, the Firewalla DDNS address stays the same and the system manages routing all traffic to the new IP. I also opened the necessary ports, which isn’t an ideal security scenario – as you can see from the screenshot of someone attempting to access my Pi almost immediately after setting it up. Thankfully Firewalla blocked it. A couple days after I first set up my server, I decided to make the switch to Cloudflare Tunnels. This allowed me to close the open ports and allow Cloudflare to handle routing traffic to my home’s IP address. I don’t have a guide I followed for this – I literally had a Zoom call with a friend of mine who is well-versed in networking and Cloudflare. I shared my screen and he walked me through which buttons to press and what information to enter in each field. The best part? It’s entirely free.
A backup solution… for now
I need to find a good way to automatically back up my Pi, probably once a week. I have a Synology NAS and so I searched for and found a couple of guides to walk me through creating a scheduled backup. Originally, I gave this guide a try since it creates an image I can just write to a new microSD card. It works, but the image size is basically the same as your microSD card, even when you’re not using all that space. I ran that backup task for a couple of days, and then I switched to RasPiBackup. The backups it creates are smaller, saving me space on my NAS, but the app requires all of the Pi’s services and apps to be closed during the backup. That means my Pi, and thus my Mastodon instance, is taken offline for upwards of 90 minutes when a backup is created. It’s not a huge deal if I run it in the middle of the night, but it’s not ideal. At first, I was making nightly backups, but I’ve since switched to weekly backups. If I can figure out a different backup solution that runs in the background and only backs up any and all data related to my Mastodon instance, I’ll switch to that.
What’s left to figure out
I’ve been monitoring how much storage space the instance is going to take up. Remember, I have a limited amount of storage. It’s not a small amount, as I used a 256GB microSD card, but it’s something I need to be aware of. Thankfully, Mastodon admins can set media retention policies in their account dashboard. Currently, I have it set to indefinitely as I watch how much space is being used. After three weeks, there’s roughly 12.2 GB of media being stored on my Pi. I may end up setting a 90-day media retention policy. But we’ll see. If you’re running your own Mastodon instance from home, especially on a Raspberry Pi, what have you done to secure your server, if anything? What about backing it up? Free free to follow me on Mastodon. You will need to sign up on a server and then you can copy and paste this link into the search bar in order to find my account: https://mrcippy.xyz/@mrcippy. If you do follow me, don’t be shy. Say hi!