Best VPS for Mastodon 2026: Host Your Own Fediverse Instance
REVIEW 11 min read fordnox

Best VPS for Mastodon 2026: Host Your Own Fediverse Instance

Find the best VPS for hosting Mastodon. Compare requirements, set up your own fediverse instance, and join the decentralized social web.


Best VPS for Mastodon in 2026

Mastodon is the decentralized Twitter alternative. Run your own instance and you control your social media — no algorithms, no ads, complete data ownership.

What is Mastodon?

Mastodon is a federated social network:

Think of it as running your own Twitter that can talk to everyone else's Twitter.

VPS Requirements

Mastodon is Ruby on Rails and resource-hungry:

Single-User Instance

Small Community (10-50 users)

Medium Instance (50-500 users)

Why So Hungry?

Mastodon runs:

It's a full stack application, not a lightweight service.

Best VPS for Mastodon

1. Hetzner CX31 (Best Value)

€10.49/mo | 2 vCPU, 8GB RAM, 80GB NVMe

8GB RAM handles single-user to small community. Hetzner's 20TB bandwidth is crucial for federation traffic.

Best for: Personal or small group instances

2. Hostinger KVM4 (Best Budget Large)

$12.99/mo | 4 vCPU, 8GB RAM, 200GB NVMe

4 cores help with background job processing. 200GB storage is generous for media.

3. Hetzner CX41 (Best for Growth)

€17.49/mo | 4 vCPU, 16GB RAM, 160GB NVMe

16GB RAM gives headroom. Upgrade path to CX51 if you grow.

4. Contabo VPS M (Most Storage)

€10.49/mo | 6 vCPU, 16GB RAM, 400GB

Contabo's specs are unmatched if you expect lots of media uploads.

Object Storage: Critical for Mastodon

Don't store media locally. Use S3-compatible object storage:

Provider Price Notes
Cloudflare R2 Free 10GB No egress fees!
Wasabi $6.99/TB No egress fees
Backblaze B2 $6/TB + bandwidth
Hetzner Storage Box €3.81/TB Good with Hetzner VPS

Cloudflare R2 is best — generous free tier, no bandwidth charges.

Complete Setup Guide

Step 1: Create Your VPS

Using Hetzner CX31:

  1. Sign up at Hetzner Cloud
  2. Ubuntu 22.04 → CX31 → Add SSH key
  3. Note IP address

Step 2: DNS Setup

A      mastodon.yourdomain.com    → your-vps-ip
AAAA   mastodon.yourdomain.com    → your-ipv6 (optional)

Step 3: Initial Server Setup

ssh root@your-vps-ip

# Update and install dependencies
apt update && apt upgrade -y
apt install -y curl wget gnupg apt-transport-https lsb-release ca-certificates

# Create mastodon user
adduser --disabled-login mastodon

# Install Node.js
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt install -y nodejs

# Install Yarn
corepack enable
yarn set version classic

# Install Ruby (rbenv)
apt install -y git build-essential libssl-dev libreadline-dev \
  zlib1g-dev libpq-dev libidn11-dev libicu-dev libjemalloc-dev \
  imagemagick ffmpeg libvips-dev libvips42

su - mastodon
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc

git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
rbenv install 3.2.3
rbenv global 3.2.3
exit

Step 4: Install PostgreSQL & Redis

# PostgreSQL
apt install -y postgresql postgresql-contrib

sudo -u postgres psql
CREATE USER mastodon CREATEDB;
\q

# Redis
apt install -y redis-server
systemctl enable redis-server

Step 5: Install Mastodon

su - mastodon
git clone https://github.com/mastodon/mastodon.git live
cd live
git checkout $(git tag -l | grep '^v[0-9.]*$' | sort -V | tail -n 1)

bundle config deployment 'true'
bundle config without 'development test'
bundle install -j$(nproc)
yarn install --frozen-lockfile

# Setup wizard
RAILS_ENV=production bundle exec rake mastodon:setup

Follow the interactive setup:

Step 6: Configure Nginx

exit # back to root

apt install -y nginx certbot python3-certbot-nginx

# Get SSL certificate
certbot --nginx -d mastodon.yourdomain.com

# Copy Mastodon nginx config
cp /home/mastodon/live/dist/nginx.conf /etc/nginx/sites-available/mastodon
ln -s /etc/nginx/sites-available/mastodon /etc/nginx/sites-enabled/

# Edit and update domain
nano /etc/nginx/sites-available/mastodon
# Change server_name to your domain

nginx -t
systemctl restart nginx

Step 7: Setup Systemd Services

cp /home/mastodon/live/dist/mastodon-*.service /etc/systemd/system/

systemctl daemon-reload
systemctl enable mastodon-web mastodon-sidekiq mastodon-streaming
systemctl start mastodon-web mastodon-sidekiq mastodon-streaming

Step 8: Create Admin Account

su - mastodon
cd live
RAILS_ENV=production bin/tootctl accounts create admin \
  --email you@yourdomain.com \
  --confirmed \
  --role Owner

Save the password shown!

Object Storage Setup (Cloudflare R2)

Create R2 Bucket

  1. Cloudflare Dashboard → R2
  2. Create bucket: mastodon-media
  3. Create API token with read/write access

Configure Mastodon

Edit /home/mastodon/live/.env.production:

S3_ENABLED=true
S3_BUCKET=mastodon-media
S3_REGION=auto
S3_PROTOCOL=https
S3_HOSTNAME=YOUR_ACCOUNT_ID.r2.cloudflarestorage.com
S3_ENDPOINT=https://YOUR_ACCOUNT_ID.r2.cloudflarestorage.com
AWS_ACCESS_KEY_ID=your-r2-access-key
AWS_SECRET_ACCESS_KEY=your-r2-secret-key
S3_ALIAS_HOST=media.yourdomain.com

Configure CDN

In Cloudflare:

  1. Add CNAME: media.yourdomain.comYOUR_ACCOUNT_ID.r2.cloudflarestorage.com
  2. Enable Cloudflare proxy (orange cloud)

Now media is served via Cloudflare CDN — fast and free bandwidth.

Email Configuration

Mastodon needs email for:

Using Resend (Recommended)

SMTP_SERVER=smtp.resend.com
SMTP_PORT=587
SMTP_LOGIN=resend
SMTP_PASSWORD=re_xxxx
SMTP_FROM_ADDRESS=notifications@yourdomain.com

Using Mailgun

SMTP_SERVER=smtp.mailgun.org
SMTP_PORT=587
SMTP_LOGIN=postmaster@yourdomain.com
SMTP_PASSWORD=your-password
SMTP_FROM_ADDRESS=notifications@yourdomain.com

Performance Tuning

PostgreSQL

Edit /etc/postgresql/15/main/postgresql.conf:

shared_buffers = 2GB
effective_cache_size = 6GB
work_mem = 16MB
maintenance_work_mem = 512MB

Redis

Edit /etc/redis/redis.conf:

maxmemory 1gb
maxmemory-policy allkeys-lru

Sidekiq Workers

Edit /etc/systemd/system/mastodon-sidekiq.service:

[Service]
Environment="MALLOC_ARENA_MAX=2"
Environment="DB_POOL=25"
ExecStart=/home/mastodon/.rbenv/shims/bundle exec sidekiq -c 25

More workers = faster job processing, but more RAM.

Enable Elasticsearch (Optional)

For full-text search:

# Install Elasticsearch
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add -
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" > /etc/apt/sources.list.d/elastic-7.x.list
apt update && apt install elasticsearch

systemctl enable elasticsearch
systemctl start elasticsearch

Configure in .env.production:

ES_ENABLED=true
ES_HOST=localhost
ES_PORT=9200

Rebuild search index:

RAILS_ENV=production bin/tootctl search deploy

Maintenance Tasks

Update Mastodon

su - mastodon
cd live

git fetch --all
git checkout $(git tag -l | grep '^v[0-9.]*$' | sort -V | tail -n 1)

bundle install
yarn install --frozen-lockfile
RAILS_ENV=production bundle exec rails db:migrate
RAILS_ENV=production bundle exec rails assets:precompile

exit

systemctl restart mastodon-web mastodon-sidekiq mastodon-streaming

Clean Up Old Media

su - mastodon
cd live

# Remove remote media older than 7 days
RAILS_ENV=production bin/tootctl media remove --days=7

# Remove orphaned files
RAILS_ENV=production bin/tootctl media remove-orphans

Schedule with cron:

0 4 * * * /home/mastodon/live/bin/tootctl media remove --days=7

Backup

# Database
pg_dump -Fc mastodon_production > backup.dump

# Environment
cp /home/mastodon/live/.env.production backup/

# Secrets
# Back up your .env.production securely!

Resource Usage

Typical single-user instance:

Component RAM
Puma (web) 500MB-1GB
Sidekiq 500MB-2GB
Streaming 100MB
PostgreSQL 1GB
Redis 200MB
Total 3-5GB

8GB gives comfortable headroom.

Federation Tips

Get Discovered

  1. Use relays — Connect to Mastodon relays for more content
  2. Follow interesting people — Their posts appear on your instance
  3. Use hashtags — Discoverable across federation

Block Bad Actors

In admin panel:

FAQ

How much does it cost to run Mastodon?

Users VPS Storage Total
1-10 €10/mo ~Free ~€10/mo
10-50 €17/mo €5/mo ~€22/mo
50-500 €35/mo €20/mo ~€55/mo

Is Mastodon hard to maintain?

Moderate. Updates are frequent. Budget 2-4 hours/month for maintenance.

Can I migrate from Twitter?

Yes! Use tools like Movetodon to find your Twitter follows on Mastodon.

Single-user or community?

Start single-user. You can open registrations later if desired.

What about moderation?

You're responsible. Single-user is easy. Community requires clear rules and active moderation.

Recommended Setup

Use Case VPS Monthly Cost
Personal Hetzner CX31 €10.49
Small Group Hostinger KVM4 $12.99
Community Hetzner CX41 €17.49

Start with Hetzner CX31 + Cloudflare R2 — about €10/month for complete fediverse independence.

~/best-vps-for-mastodon/get-started

Ready to get started?

Get the best VPS hosting deal today. Hostinger offers 4GB RAM VPS starting at just $4.99/mo.

Get Hostinger VPS — $4.99/mo

// up to 75% off + free domain included

// related topics

best vps for mastodon mastodon hosting fediverse server self-hosted mastodon mastodon instance

fordnox

Expert VPS reviews and hosting guides. We test every provider we recommend.

// last updated: February 8, 2026. Disclosure: This article may contain affiliate links.