I started my own Mastodon server on a Raspberry Pi. Here’s what I learned
I’ve used Twitter every single day for the last 15 years or so. It’s been an immeasurable tool that’s helped me do my job, but more importantly, it was a networking tool that helped me get new freelancing jobs. I’d imagine about 80% of my freelancing work has come from people I’ve interacted and met with on Twitter.
But, as I’m sure most are aware, Twitter is a bit of a mess right now. 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: Where to buy a Raspberry Pi 4 and possible alternatives
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 roughly 24 hours of having my own Mastodon server, complete with a custom domain name, I have no regrets. There’s something almost 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’ve been able to use Mastodon just as I had over at Mastodon.social and Journa.host. In fact, I have redirected both accounts to my new account @[email protected]. 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?”).
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, and it’s something I’ll hopefully never have to do again.
Outside of migrating accounts, the rest of the experience has been hiccup-free. I’m really impressed with how fast my timeline loads, including posting photos and videos.
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).
The worst part about wanting to do any sort of Raspberry Pi project right now is that you simply can’t find them in stock. They’ve been in short supply for some time and the listings on Amazon are overpriced, to say the least. If you can be patient, I suggest using rpilocator.com‘s stock tool to find a Pi 4 for a reasonable price.
Also: Why a Raspberry Pi 5 in 2023 could be a disaster
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.
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.
curl -sL https://deb.nodesource.com/setup_16.x | sudo bash –
sudo apt install nodejs
node -v
Once you’re done with that part of the installation, go back to the PiMyLifeUp guide and follow the rest of it.
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 forwarded ports 80 and 443 on your local network to your Raspberry Pi before you get to the Let’s Encrypt portion of the tutorial.
I have Firewalla Gold Plus installed on my home network and I was able to use 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.
What’s left to figure out
I need to find a good way to automatically back up my Pi, probably once a week. I have a Synology NAS and I’ve found a couple of guides that walk through creating a scheduled backup, but I need to take the time to go through one. I think I’m going to give this guide a try since it creates an image I can just write to a new microSD card.
I also need to take some time to figure out any extra security measures I need to implement. Right now, I’m relying on Firewalla Gold Plus and its firewall capabilities to stop any attempted attacks — and it took all of about 5 hours before I got an alert from the Firewalla app that someone in China was trying to access the Pi.
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!
For all the latest Technology News Click Here
For the latest news and updates, follow us on Google News.