How to Set Up a Single-User Mastodon Instance for Yourself
🔍 WiseChecker

How to Set Up a Single-User Mastodon Instance for Yourself

Running your own Mastodon instance gives you full control over your social media presence, data, and moderation policies. A single-user instance is a private Mastodon server that only you use, which eliminates federation noise from large public instances while still allowing you to follow and interact with anyone on the fediverse. This guide walks through the entire process from server acquisition to daily operation. You will learn how to deploy a secure, single-user Mastodon instance using a cloud server and Docker.

Key Takeaways: Deploying a Private Single-User Mastodon Instance

  • Domain name and cloud VPS: Required minimum 2 GB RAM and 50 GB SSD storage for a single-user Mastodon instance.
  • Docker Compose deployment: Mastodon’s official docker-compose.yml file automates the setup of PostgreSQL, Redis, and the Mastodon web service.
  • Nginx reverse proxy with Let’s Encrypt: Provides HTTPS encryption and routes traffic to the Mastodon container on port 3000.

Understanding the Requirements for a Single-User Mastodon Instance

A single-user Mastodon instance is a fully functional Mastodon server configured to allow only one registered account. Unlike public instances, you do not need to manage user registrations, spam filters, or resource contention. The server still federates with other instances, meaning your posts appear in public timelines elsewhere and you can follow users on other servers. The key components are a domain name, a virtual private server with at least 2 GB of RAM and 50 GB of storage, and a basic understanding of the Linux command line. Mastodon uses PostgreSQL for database storage, Redis for caching and background job queues, and Nginx as a reverse proxy. All services run inside Docker containers for easy management and updates.

Hardware and Software Prerequisites

You need a domain name that points to your server’s IP address. Any DNS provider works. The server must run Ubuntu 22.04 or Debian 12. You also need SSH access with a sudo-enabled user. Install Docker and Docker Compose on the server before starting the Mastodon installation. A single-user instance typically uses about 1 GB of RAM during idle periods and spikes to 2 GB when processing media uploads or federation activities. Choose a VPS plan that offers at least 2 GB RAM and 50 GB of SSD storage. Providers like DigitalOcean, Linode, or Hetzner offer suitable plans starting at around 6 USD per month.

Steps to Deploy a Single-User Mastodon Instance

Follow these steps to set up your private Mastodon instance. The process takes about one hour from start to finish.

  1. Point your domain to the server IP
    Log into your DNS provider’s control panel. Create an A record for your domain (for example, social.example.com) that points to your server’s public IPv4 address. Wait for DNS propagation, which usually takes under 10 minutes.
  2. SSH into the server and install Docker
    Run the official Docker installation script: curl -fsSL https://get.docker.com -o get-docker.sh && sudo sh get-docker.sh. Then install Docker Compose: sudo apt-get install docker-compose-plugin. Verify both installations with docker --version and docker compose version.
  3. Clone the Mastodon repository
    Run git clone https://github.com/mastodon/mastodon.git in your home directory. Change into the mastodon directory: cd mastodon. Check out the latest stable release tag: git checkout $(git tag -l | grep '^v' | sort -V | tail -n 1).
  4. Generate Mastodon configuration
    Copy the example environment file: cp .env.production.sample .env.production. Run docker compose run --rm web bundle exec rake mastodon:setup. This interactive script asks for your domain name, admin email, and database credentials. Accept all defaults for PostgreSQL and Redis settings. The script generates the SECRET_KEY_BASE, OTP_SECRET, and VAPID keys automatically.
  5. Start Mastodon services
    Run docker compose up -d. This starts the PostgreSQL, Redis, web, sidekiq, and streaming containers. Wait 30 seconds for the database to initialize. Check the logs: docker compose logs -f web. Look for the line that says “Listening on http://0.0.0.0:3000” to confirm the web service is running.
  6. Configure Nginx reverse proxy with HTTPS
    Copy the sample Nginx configuration: sudo cp nginx.conf /etc/nginx/sites-available/mastodon. Edit the file to replace example.com with your actual domain. Set the proxy_pass to http://127.0.0.1:3000. Enable the site: sudo ln -s /etc/nginx/sites-available/mastodon /etc/nginx/sites-enabled/. Install Certbot: sudo apt-get install certbot python3-certbot-nginx. Run sudo certbot --nginx -d yourdomain.com to obtain and install a Let’s Encrypt SSL certificate. Restart Nginx: sudo systemctl restart nginx.
  7. Create the admin account and disable registrations
    Visit https://yourdomain.com in a browser. Complete the initial registration form to create your account. Then run docker compose run --rm web bin/tootctl accounts modify yourusername --role admin to promote the account to admin. Finally, disable public registrations by setting SINGLE_USER_MODE=true in the .env.production file and restarting: docker compose restart web.

Common Configuration Issues and How to Avoid Them

Email delivery setup fails during initial configuration

The Mastodon setup script asks for SMTP credentials. If you skip this step, password reset emails and confirmation emails will not be sent. Use a transactional email service like Mailgun or SendGrid. Enter the SMTP host, port, username, and password during the setup script. Alternatively, edit .env.production later and restart the containers.

Web interface shows 502 Bad Gateway error after deployment

This usually means Nginx cannot reach the Mastodon web container. Verify that the web container is running with docker compose ps. Check if the container listens on port 3000: curl http://127.0.0.1:3000. If the container is not running, check the logs: docker compose logs web. Common causes include database connection failures or missing secret keys in .env.production.

Federation does not work after instance goes live

Other instances cannot see your posts if your server’s firewall blocks outgoing ports 443 and 80. Ensure your VPS firewall allows outbound HTTPS traffic. Also verify that your domain’s A record points to the correct IP. Use the Mastodon federation tester at https://fedi.tips/mastodon-instance-check to confirm your instance is reachable from the outside.

Item Single-User Instance Public Instance
Description Private server with one user account Open registration server for many users
Resource usage 1-2 GB RAM, 50 GB storage 4-16 GB RAM, 100+ GB storage
Moderation effort None required Daily moderation of reports and spam
Federation control Full control over blocked instances Shared control with other admins
Monthly cost 6-12 USD 20-100+ USD

You now have a fully functional single-user Mastodon instance under your own domain. Log in and post your first toot to verify that federation works. For advanced control, explore the admin panel at https://yourdomain.com/admin to configure instance blocks, custom emoji, and content retention policies. Set up automatic backups of the PostgreSQL database by adding a cron job that runs docker compose exec db pg_dump -U postgres mastodon_production > backup.sql daily.