Home / Servers / Mastodon VPS

Self-host Mastodon on a no-KYC VPS

Run your own Mastodon server with handles on your domain and moderation rules you set. The timeline is chronological, with no ads and no algorithm, and it federates with the rest of the fediverse. Sign up with a generated credential and pay with crypto, card or cash.

Deploy a Mastodon server from $9.99 a month4 GB for a single-user server
  • No email or ID
  • Port 25 open
  • Federates over ActivityPub

What a Mastodon server runs

Five services run before you add search, so plan on at least 4 GB.

Web (Puma)
The Rails app behind the website and the API every client talks to. Memory grows with WEB_CONCURRENCY, the number of worker processes.
Sidekiq
Background jobs: delivering posts to other servers, fetching remote posts and media, sending mail. Federation load lands here.
Streaming
A small Node.js service that pushes new posts to open apps and browsers as they arrive.
PostgreSQL
Every post, account and follow your server knows about, including copies of posts from remote accounts.
Redis
Job queues for Sidekiq and the home timeline of every account on the server.
Search (optional)
Elasticsearch for full-text search. Mastodon tests against version 7 and says OpenSearch should work, without official support. It is a Java service that can need more memory than Mastodon itself, so it usually means a bigger plan.

Which plan for which instance

Blackbox planWhy
Just you, or a few friends Core, 4 GB The whole stack fits with default settings. Leave search off and prune the media cache.
A community of dozens Plus, 8 GB Room for more web workers and Sidekiq threads, or for search, and 100 GB of disk for media.
Hundreds of active users Max, 16 GB 200 GB of disk and room to split Sidekiq queues. Move media to object storage before the disk fills.

Install Mastodon with Docker Compose

Debian 12 or Ubuntu 24.04. Point social.example.com at the server and have SMTP details ready, because the wizard asks for them.

# Debian 12 or Ubuntu 24.04, as root
curl -fsSL https://get.docker.com | sh
apt install -y git caddy

# 1. The newest release and the compose file that ships with it
git clone https://github.com/mastodon/mastodon.git /opt/mastodon
cd /opt/mastodon
git checkout $(git tag -l | grep '^v[0-9.]*$' | sort -V | tail -n 1)
docker compose pull

# 2. The wizard. Say yes to Docker and keep its defaults:
#    PostgreSQL host db, user postgres, no password, Redis
#    host redis. Let it prepare the database and create
#    your admin account.
touch .env.production
docker compose run --rm web bundle exec rake mastodon:setup
# Under Docker it prints your configuration before it
# prepares the database: paste all of it into
# .env.production. The last thing it prints is the
# admin password, so save that too.

# 3. The containers write media as uid 991
mkdir -p public/system && chown -R 991:991 public/system
docker compose up -d

# 4. HTTPS. Streaming goes to port 4000, the rest to 3000.
cat > /etc/caddy/Caddyfile <<'EOF'
social.example.com {
  encode gzip
  handle /api/v1/streaming* {
    reverse_proxy localhost:4000
  }
  handle {
    reverse_proxy localhost:3000
  }
}
EOF
systemctl reload caddy

What to watch out for

Your database holds every DM in the clear

Mastodon stores every post in PostgreSQL as plain text, private mentions (its direct messages) included, along with the sign-in IP addresses it records for each account. Its own docs warn that the database admins on both ends of a private mention may be able to read it. On Blackbox that database sits in memory the host cannot read, and on an encrypted disk once you turn disk encryption on.

MontrealAmsterdamNew York City (launch pre-order)Singapore (launch pre-order)
Deploy Blackbox from $9.99 a month
  • Set IP_RETENTION_PERIOD in .env.production to keep sign-in IPs for less than Mastodon's default of one year.
  • With disk encryption on, .env.production and the keys in it sit on the same encrypted disk as the database. You type the passphrase over SSH after each reboot.
  • Federation traffic and remote media fetches count toward the plan's transfer allowance, so a server that follows relays uses it faster.

How Blackbox works

Plans

PlanvCPURAMNVMeTrafficWherePrice
Blackbox Core 2 4 GB 50 GB 4 TB per 31 days MontrealAmsterdamNew York City (launch pre-order)Singapore (launch pre-order) $9.99/mo
Blackbox Plus 4 8 GB 100 GB 8 TB per 31 days MontrealAmsterdamNew York City (launch pre-order)Singapore (launch pre-order) $19.99/mo
Blackbox Max 6 16 GB 200 GB 16 TB per 31 days MontrealAmsterdamNew York City (launch pre-order)Singapore (launch pre-order) $39.99/mo
Blackbox Ultra 8 32 GB 400 GB 32 TB per 31 days MontrealAmsterdamNew York City (launch pre-order)Singapore (launch pre-order) $79.99/mo
Any term from 7 to 365 days, prorated by the day. Blackbox: AMD SEV-SNP encrypted memory on Linux images, a dedicated IPv4, a routed IPv6 /64 and a 10 Gbps port. Past the transfer allowance the port drops to 10 Mbps until the period rolls over; nothing extra is billed. Pre-orders are paid now, deploy when room opens, and are final. Deploy

Mastodon federates fine over IPv4 alone. If Blackbox has not opened in New York City or Singapore yet, the standard VPS line sells there, with unmetered bandwidth, no IPv6 and no memory encryption.

Questions

How much server do I need?

Blackbox Core, with 2 vCPU and 4 GB, runs a single-user server or one for a few friends. A community of dozens is more comfortable on Plus with 8 GB, and so is any server with full-text search turned on. Disk usually runs out before memory, because Mastodon keeps copies of media from other servers.

Do I need an SMTP server?

You need a way to send mail, because Mastodon emails sign-up confirmations, password resets and admin notices. The setup wizard asks for SMTP details. A transactional mail service is the simplest choice. You can also run your own mail server, since port 25 is open on Blackbox.

Can I run a single-user instance?

Yes. Answer yes to single user mode in the setup wizard. The front page then redirects to your profile and registrations stay closed. Your handle lives on your own domain, so no other server's admin can take it away.

How do I store media efficiently?

On a small server, keep media on local disk and prune the cache of remote media on a schedule. Past that, turn on S3-compatible object storage in .env.production (S3_ENABLED=true plus the bucket settings) and media stops using the server's disk.

How do I get federated quickly?

Federation starts when someone on your server follows a remote account: that account's server then sends you its new posts. Follow the people you want to read on the first day. Mastodon speaks ActivityPub, so your accounts can follow and reply to people on Pixelfed, PeerTube, Misskey, Lemmy and other fediverse software too. Relays send you far more posts, and fill the disk far faster.

Does it work with iOS and Android apps?

Yes. The official Mastodon apps and third-party ones such as Ivory, Ice Cubes, Tusky and Fedilab all accept any server address at login.

How do I back up?

Dump the database with pg_dump, copy public/system if media is stored locally, and keep .env.production with them. Schedule it with restic or borg to storage off the server.

Does Servury log my traffic?

No. We keep no traffic logs and don't log your IP or activity, and Blackbox runs no agent inside your server. Mastodon keeps its own records, such as sign-in IP addresses, in your database, and you decide how long.

Guides on this topic

Related pages

Support

Questions before you buy? Ask here. You do not need an account: your first message creates one, and you get its credential to come back for our reply.