Video coming soon…

🐘 Setup Mastodon — Self-Hosted Fediverse Social Network

Decentralized Twitter-like microblogging platform — deploy your own Mastodon instance and join the Fediverse with full ActivityPub federation.

⚠️ This script is provided for demo and testing purposes only. Not intended for production use.

📦 Resources & Setup Scripts

Grab the automated bash script from GitHub to follow along with the video.

Automated install script — your own Mastodon social network running in one command.
View on GitHub

Quick Install:

wget https://raw.githubusercontent.com/mhmdali94/Docker/main/social/mastodon/mastodon-ubuntu.sh
chmod +x mastodon-ubuntu.sh
sudo bash mastodon-ubuntu.sh

Tutorial Steps

1 Download & Run Installer

The script installs Docker if needed, then pulls the Mastodon web, Sidekiq worker, streaming API, PostgreSQL, and Redis images and starts all containers. Mastodon web UI will be available on port 3000.

wget https://raw.githubusercontent.com/mhmdali94/Docker/main/social/mastodon/mastodon-ubuntu.sh
chmod +x mastodon-ubuntu.sh
sudo bash mastodon-ubuntu.sh

2 Access Web UI & Create Admin

Open your browser and navigate to Mastodon. Register the first account, then promote it to admin using the Rails console or the tootctl command-line tool. This admin account controls your entire instance.

http://<your-server-ip>:3000

3 Configure Your Instance

Log into the admin panel and configure your instance settings: set the instance name and description, upload a logo and banner, write your community rules, and configure registration policy (open, approval-required, or invite-only). Set up SMTP email settings for user verification and notifications.

http://<your-server-ip>:3000/admin/settings/edit

4 Enable Federation

Federation is enabled by default in Mastodon. Users on your instance can search for and follow accounts on other Mastodon servers using the @user@domain.com format. You can manage federation in the admin panel — relay servers can be added to boost content discovery, and you can block specific domains that violate your instance rules.

Ports Used

PortPurpose
3000Mastodon Web UI
4000Streaming API
5432PostgreSQL (internal)
6379Redis (internal)

Overview

Mastodon is an open-source federated microblogging platform — a decentralized alternative to Twitter and X. Each Mastodon server (instance) is independently operated but interconnected via ActivityPub, allowing users to follow people and interact across thousands of different instances worldwide.

Why Use It

Running your own Mastodon instance gives your community or organization a social network on your own domain, under your own moderation policies, without algorithmic timelines or advertising. Your users own their accounts and can migrate them to other instances if needed.

When You Need It

    Who Should Use It

      Real Use Cases

        Main Features

          How to Use After Installation

            Security Best Practices

              Ports and Firewall Notes

              Mastodon's web interface runs on port 3000 and streaming API on port 4000. Always serve both via HTTPS through a reverse proxy. Both must be accessible for full functionality. Media storage should be configured as S3-compatible object storage for scalability.

              Backup and Maintenance

                Common Mistakes

                  Troubleshooting

                    Alternatives

                    Alternatives include Misskey and Akkoma (also Fediverse, different UX), Pleroma (lightweight, same protocol), Pixelfed (image-focused), and Threads (Meta's Fediverse entry, cloud). Choose Mastodon for the largest Fediverse instance count, most mature software, and widest app ecosystem.

                    When Not to Use It

                    Avoid Mastodon for small personal deployments — the resource requirements are significant (at minimum 2 GB RAM). For a personal single-user instance, consider a lighter Fediverse server like Pleroma or Akkoma instead.

                    PrismaTechWork Professional Help

                    PrismaTechWork provides end-to-end infrastructure services — from initial deployment and security hardening to ongoing monitoring, automated backups, and dedicated support. Whether you need a single-server setup or a multi-site network, our team ensures your infrastructure is built right, secured properly, and maintained reliably.

                      Contact Us

                      Frequently Asked Questions

                      What is the Fediverse?

                      The Fediverse is a collection of independently operated social servers that communicate with each other via the ActivityPub protocol. Mastodon, Pixelfed, PeerTube, Lemmy, and many other platforms are part of the Fediverse. Users on any instance can follow users and interact with content on any other compatible instance.

                      Can I use a custom domain for my Mastodon instance?

                      Yes — and a custom domain is strongly recommended. Your users will have handles like @username@yourdomain.com. The domain is permanent — changing it later breaks federation and all existing follower relationships. Choose your domain carefully before launch.

                      How much storage does Mastodon require?

                      Media storage grows rapidly, especially on a federated instance that caches remote media from other instances. Plan for tens to hundreds of GB for even modest instances. Use S3-compatible object storage (Backblaze B2, AWS S3, or Wasabi) rather than local disk for scalable and cost-effective media storage.

                      Can I limit who can join my Mastodon instance?

                      Yes. Set registrations to Approval Required where admins manually approve each new user, or Invite Only where new users need an invitation link from an existing member. This gives you full control over who joins your community.

                      What is defederation and when should I use it?

                      Defederation (also called suspending an instance) means blocking all communication between your instance and another. Use it when an instance consistently hosts spam, harassment, illegal content, or violates your community standards. Defederated instances cannot see your users or send them messages.

                      Does Mastodon have a mobile app?

                      Yes. The official Mastodon app is available for iOS and Android. Many excellent third-party apps also exist: Ivory (iOS, premium), Tusky (Android, free), Mona (iOS), and others. All apps work with any Mastodon instance — you enter your instance URL during setup.

                      Can I migrate my account to a different Mastodon instance?

                      Yes. Mastodon has a built-in account migration feature. Create an account on the destination instance, set a forwarding redirect on your old account, then export your followers list and import it on the new account. Followers are notified and redirected automatically. Old posts do not migrate.

                      What is Sidekiq and why does Mastodon need it?

                      Sidekiq is a Ruby background job processor that Mastodon uses for all asynchronous tasks: federating posts to other instances, sending emails, processing media, generating notifications, and cleaning up old data. Without Sidekiq running, Mastodon appears to work but nothing gets sent or received from other instances.