Decentralized Twitter-like microblogging platform — deploy your own Mastodon instance and join the Fediverse with full ActivityPub federation.
Grab the automated bash script from GitHub to follow along with the video.
wget https://raw.githubusercontent.com/mhmdali94/Docker/main/social/mastodon/mastodon-ubuntu.sh
chmod +x mastodon-ubuntu.sh
sudo bash mastodon-ubuntu.sh
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
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
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
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.
| Port | Purpose |
|---|---|
| 3000 | Mastodon Web UI |
| 4000 | Streaming API |
| 5432 | PostgreSQL (internal) |
| 6379 | Redis (internal) |
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.
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.
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.
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.
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 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.
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.
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.
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.
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.
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.
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.
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.
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.