HYEHOST

How to Self-Host Mastodon 5.0 on a VPS

You can run a Mastodon server for a handful of friends and still follow people across thousands of other servers. Here’s how to give yours a permanent address, bring it online and check that posts make the return trip.

Set up the serverTest federation
HYEHOST bear connecting a Mastodon server to the wider social network

A Mastodon server, also called an instance, gives its members a home for their accounts, posts and photos. Two friends can have accounts on different servers and still follow each other. Their servers exchange messages using ActivityPub. That exchange is called federation, and it’s the part worth testing before you invite anyone.

Mastodon 5.0 arrived on 2 December 2026. Members will notice the new composer and clearer labels for who can see a post. For someone hosting the software, the change that matters on day one is the updated set of dependencies. This walkthrough follows a fresh, single-VPS installation from source. Mastodon 5.0 announcement

Choose the address you want people to keep

Imagine your club already has a website at example.org. Give Mastodon its own hostname, social.example.org, and a member named Jo will be @jo@social.example.org. Your club website can stay where it is. You can move the instance to another VPS later and keep those handles if you retain the domain and migrate the data.

For that setup, point the subdomain’s A record at your VPS’s public IPv4 address. Add an AAAA record if the server also accepts HTTPS over IPv6. Set LOCAL_DOMAIN to the hostname alone. Mastodon requires you to keep this value once people have started using the instance. If you want the shorter @jo@example.org address while serving pages from the subdomain, configure WEB_DOMAIN and WebFinger delegation on the main domain before creating accounts. Mastodon domain configuration

What does a small Mastodon server need?

For a small invite-only community, our suggested starting point is a Linux VPS with 4 GB RAM and at least 2 vCPUs, with media growth budgeted separately. Watch the first week of use before you open registrations. A few members following busy photo accounts can consume more disk than a larger group mostly sharing text.

Web and workers

The web process serves pages. Sidekiq handles jobs such as delivering posts and email. Streaming sends live updates to connected clients. Watch queue age alongside memory and CPU.

Database and media

PostgreSQL holds accounts, posts and follows. Redis holds queues and feeds. Photos and videos use their own storage, including cached copies from other servers. Leave space for updates and backups.

Outbound email

Have an SMTP account ready for sign-up and password-reset emails. Verify the sender with your email provider and send a test to a mailbox outside your own domain.

Install Mastodon 5.0 on the VPS

The upstream source guide covers Debian 13 and Ubuntu 24.04. Start with a fresh VPS, working SSH key access and a hostname that resolves from outside your network. Allow public HTTP and HTTPS. Keep PostgreSQL and Redis reachable only by the application on the same machine. Prepare the VPS

  1. Install the release’s dependencies. Follow the upstream package and service instructions. Version 5.0 requires Ruby 4.0, Node.js 24 or newer, PostgreSQL 14 or newer, Redis 7.2 or newer, libvips 8.13 or newer and FFmpeg 5.1 or newer. Choose maintained versions and check the actual Redis version your distribution installs. An older package can install successfully and still be unsuitable. 5.0 release requirements · Redis packages for Debian and Ubuntu
  2. Prepare the application account. Follow the source guide to create the Linux user and matching PostgreSQL role. Enable Corepack for Yarn. Sign in as the mastodon user and initialise rbenv with ruby-build in that account. Upstream installation steps
  3. Install the tagged release. The commands below start in the application user’s home directory. Version 5.0.0 was the stable release on 4 December. If a newer stable 5.0.x patch is available when you install, substitute its tag. The checkout specifies which Ruby to build and which dependencies to install. Check stable releases
cd /home/mastodon
git clone --branch v5.0.0 https://github.com/mastodon/mastodon.git live
cd live
RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install -s
bundle config set --local deployment true
bundle config set --local without 'development test'
bundle install
yarn install --immutable

In the same directory, run the setup wizard below on the fresh instance. Enter your permanent domain, local database and Redis settings, SMTP details and media storage choice. Let the wizard prepare the new database and assets. Save the generated .env.production securely. An existing instance has a separate upgrade procedure.

RAILS_ENV=production bin/rails mastodon:setup

As the server administrator, obtain a TLS certificate for the hostname. Enable the Nginx configuration from the release’s dist directory, set the hostname and certificate paths, and check it with sudo nginx -t before reloading. Install the supplied systemd unit files, including the streaming template. With the default paths, these commands start the processes and check the worker that actually handles streaming on port 4000. Mastodon’s supplied service and proxy files

sudo systemctl daemon-reload
sudo systemctl enable --now mastodon-web mastodon-sidekiq mastodon-streaming
systemctl is-active mastodon-web mastodon-sidekiq mastodon-streaming@4000

Look for three active results. Sign in with the owner account created during setup, or use the documented owner-account command if you skipped that step. Keep registrations closed while testing. Add a contact address and community rules so members know where to report a problem. Account and site settings

Test a password reset, a remote follow and a reply

Open your instance in a private browser window and request a password reset for a test account. The email should arrive, and its link should take you to your own HTTPS hostname. A successful local sign-in alone tells you very little about whether a member who loses their password can get back in.

Next, check account discovery from a computer outside the VPS. Replace social.example.org in both places below and jo with an existing local username. The response should identify your account in subject and contain a self link pointing to its ActivityPub profile. If the response is your HTML homepage, check how your proxy routes /.well-known/webfinger. WebFinger response format

curl -fsSL --get 'https://social.example.org/.well-known/webfinger' \
  --data-urlencode 'resource=acct:jo@social.example.org'
  1. From an account on a second server, search for the full handle and follow it. Approve the request locally if the account requires approval.
  2. Publish a new followers-only post on your server. Check that the remote follower sees it in their home feed. Reply from the remote account and open the reply on the original server.
  3. If discovery works but posts stall, check Sidekiq’s queue and retries. If posts appear only after you refresh the browser, check the streaming worker and the Nginx streaming route. These symptoms point to different services.

Protect the first week of posts

Schedule an off-site PostgreSQL backup, keep an encrypted copy of the application secrets, and back up uploaded media. For local storage, that media lives in public/system. If you use object storage, test how you would recover a deleted object. Include Redis persistence if you need to recover queued deliveries. When estimating disk growth, measure local uploads separately from cached remote media. Mastodon backup checklist

Try a restore on an isolated VM with outgoing federation and email blocked. Check that a test post, a locally uploaded image and its author’s account all reappear. Keep the recovered copy isolated while the real instance is online. Two servers delivering as the same domain would make the test visible to your members and their followers.

Mastodon hosting questions

Can I run a Mastodon server for one person?

Yes. Leave registrations closed and use your own account to follow and interact with people elsewhere. Your server will still receive posts and media from the accounts you follow, so allow for disk growth even if you never add another member.

Why is my new server’s feed so quiet?

A new instance has few connections. Follow a few remote accounts by their full handles and check for new posts after the follow. Your server doesn’t automatically download the entire network or every account’s posting history.

Do I need a separate server for media?

You can start with local disk. Consider object storage when uploads are growing faster than the rest of the VM or when you need storage capacity independent of CPU and RAM. Plan the media hostname and how you’ll back up originals before moving existing files.