Mastodon is a free, open-source social media platform designed as a decentralized, federated network. It allows users to join or create independent servers, known as instances, which interoperate within the broader Fediverse using the ActivityPub protocol. This structure empowers users with greater control over their data, privacy, and community moderation policies. Each instance can define its own rules, themes, and guidelines, fostering diverse and tailored communities. Users can post “toots” with customizable character limits, share media, create polls, and apply content warnings for sensitive topics. The platform prioritizes privacy by avoiding centralized data collection, letting users choose instances that align with their values. It also supports interoperability with other ActivityPub-compatible services, expanding user interactions across the Fediverse. Robust moderation tools are integrated. In this step by step guide I will show you how to install Mastodon on your UGREEN NAS using Docker and Portainer.
Mastodon v4.3.9Ā release.
This guide works perfectly with the latestSTEP 1
Please Support My work by Making a Donation.
STEP 2
InstallĀ Portainer using my step by step guide. If you already have Portainer installed on your UGREEN NAS, skip this STEP. Attention: Make sure you have installed the latest Portainer version.
STEP 3
ā ļøMandatory: Enable HTTPS on your UGREEN NAS.
STEP 4
Create a new hostname on the noip website using your noip account. For example, I have created mariusdonĀ as hostname and I use the free ddns.net domain. In the IP Address area, type in your own IPV4 IP address from your ISP, then click Create/Add Hostname. Follow the instructions in the image below.
STEP 5
Go toĀ FilesĀ and open the docker folder. Inside the docker folder, create one new folder and name itĀ mastodon. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.
STEP 6
Now create three new folders inside the mastodon folder that you have previously created at STEP 5 and name them config, db, redis.Ā Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.
STEP 7
Log into Portainer using your username and password. On the left sidebar in Portainer, click on StacksĀ thenĀ + Add stack. Follow the instructions in the image below.
STEP 8
In the Name field type in mastodon. Follow the instructions in the image below.
services: mastodon-redis: image: redis container_name: Mastodon-REDIS hostname: mastodon-redis security_opt: - no-new-privileges:true healthcheck: test: ["CMD-SHELL", "redis-cli ping || exit 1"] user: 999:10 environment: - TZ=Europe/Bucharest volumes: - /volume1/docker/mastodon/redis:/data:rw restart: on-failure:5 mastodon-db: image: postgres:17 container_name: Mastodon-DB hostname: mastodon-db security_opt: - no-new-privileges:true healthcheck: test: ["CMD", "pg_isready", "-q", "-d", "mastodon", "-U", "mastodonuser"] timeout: 45s interval: 10s retries: 10 volumes: - /volume1/docker/mastodon/db:/var/lib/postgresql/data:rw environment: POSTGRES_DB: mastodon POSTGRES_USER: mastodonuser POSTGRES_PASSWORD: mastodonpw restart: on-failure:5 mastodon: image: lscr.io/linuxserver/mastodon:latest container_name: Mastodon hostname: mastodon security_opt: - no-new-privileges:true environment: - PUID=999 - PGID=10 - TZ=Europe/Bucharest - DEFAULT_LOCALE=en - LOCAL_DOMAIN=mariusdon.ddns.net - WEB_DOMAIN=mariusdon.ddns.net - REDIS_HOST=mastodon-redis - REDIS_PORT=6379 - DB_HOST=mastodon-db - DB_USER=mastodonuser - DB_NAME=mastodon - DB_PASS=mastodonpw - DB_PORT=5432 - ES_ENABLED=false - ES_HOST=es - ES_PORT=9200 - ES_USER=elastic - ES_PASS=elastic - SECRET_KEY_BASE=PIWLVVi14fqae5Ds8JqEGb3jGv3zVWJOoyxo6B2346vA00S3lzSL0cf3J0yxcB5pmu05qUHLQwIG8m8M97w56qvflufm7qdlRWoZoQ7sQjMDypdhRC54FcGD3rlSsBk4 - OTP_SECRET=wjZtoiw3udx1V586bVkGCkg1MrZ0UuRBSKVj8ghsrF4eGSCPLMhHw234lGRwkTAMUKy5TRZbUXgPqK5POkvCVof8lse7KJGVPgWHdkwrvyzhUTPp8b1vvBMABVQ76rCM - ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY=6egLIdkH0vE5UXIwyZeU1qSL6tXwhd4j - ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY=bMQ59AJmJRCogwsgeFuqt8BXqwAf1Yt8 - ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT=ZpawFWM4ArOqRZbRtkYXeIqIKWLlsYZX - S3_ENABLED=false volumes: - /volume1/docker/mastodon/config:/config:rw ports: - 8562:443 restart: on-failure:5 depends_on: mastodon-redis: condition: service_healthy mastodon-db: condition: service_started
Note: Before you paste the code above in the Web editor area below, change the value numbers for user with your own UID and GID values. (Follow my step by step guide on how to do this.) 999 is my personal UID value and 10Ā is my personal GID value. You have to type in your own values.
Note: Before you paste the code above in the Web editor area below, change the value for TZ.Ā (Select your current Time Zone from this list.)
Note: Before you paste the code above in the Web editor area below, change the value numbers for PUIDĀ andĀ PGIDĀ with your own values. (Follow my step by step guide on how to do this.) 999 is my personal PUID value and 10 is my personal PGID value. You have to type in your own values.
Note: Before you paste the code above in the Web editor area below, change the value for LOCAL_DOMAINĀ and type in your own synology.me DDNS that you have previously created at STEP 6.
Note: Before you paste the code above in the Web editor area below, change the value for WEB_DOMAINĀ and type in your own synology.me DDNS that you have previously created at STEP 6.
Note: Before you paste the code above in the Web editor area below, change the value for SECRET_KEY_BASE.Ā (Generate your own 128 length SECRET_KEY_BASE.)
Note: Before you paste the code above in the Web editor area below, change the value for OTP_SECRET.Ā (Generate your own 128 length OTP_SECRET.)
Note: Before you paste the code above in the Web editor area below, change the value for ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY.Ā (Generate your own 32 length ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY.)
Note: Before you paste the code above in the Web editor area below, change the value for ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY.Ā (Generate your own 32 length ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY.)
Note: Before you paste the code above in the Web editor area below, change the value for ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT.Ā (Generate your own 32 length ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT.)
STEP 9
Scroll down on the page until you see a button namedĀ Deploy the stack. Click on it. Follow the instructions in the image below. The installation process can take up to a few minutes. It will depend on your Internet speed connection.
STEP 10
If everything goes right, you will see the following message at the top right of your screen: āSuccess Stack successfully deployedā.
STEP 11
On the left sidebar in Portainer, click Containers. Identify your Mastodon instance, then click on the little terminal icon. Follow the instructions in the image below.
STEP 12
After you click on the little terminal icon at STEP 11, a new page will open. Click Connect. Follow the instructions in the image below.
STEP 13
After you click Connect at STEP 12, a Console will open. Copy Paste the code below and follow the instructions in the image.
tootctl accounts create marius --email yourownemail --confirmed --role Owner
Note: Before you paste the code above in the Console area below, change marius with your own name.
Note: Before you paste the code above in the Console area below, change yourownemail text with your email.
STEP 14
Once the code is inserted, confirm by pressing Enter on your keyboard to start the process of password creation. After some seconds, you will get a new password for the user you have previously created at STEP 13. Copy the password and save it in a safe place – you will need it later at STEP 21.
STEP 15
After your new password is created, copy paste the code below and follow the instructions in the image.
tootctl accounts approve marius
Note: Before you paste the code above in the Console area below, change marius with your own name that should be the same as the name that you have previously created at STEP 13.
STEP 16
Open your Nginx Proxy Manager container that you have previously installed at STEP 3. Click Add Proxy Host. A new pop up window will open. Add the following details:
Domain Names: Type in your own noip domain name that you have previously created at STEP 4.
Scheme: https
Forward Hostname/IP: Type in the local NAS IP of your UGREEN NAS.
Forward Port: Type in the InvoiceShelf local Port that is 8562
Check Block Common Exploits
Check Websockets Support
Click the SSL tab. Follow the instructions in the image below.
STEP 17
After you click the SSL tab, add the following details:
SSL Certificate: Request a new SSL Certificate
Check: Force SSL
Check: HSTS Enabled
Check: HTTP/2 Support
Email Address for Let’s Encrypt: Type in your own Email Address.
Check: I Agree to the Let’s Encrypt Terms of Service.
Click Save. Follow the instructions in the image below.
STEP 18
In the Proxy Hosts area, if everything goes right, you will see that your mastodon hostname has been generated. Click on it. Follow the instructions in the image below.
STEP 19
š¢Please Support My work by Making a Donation. Almost 99,9% of the people that install something using my guidesĀ forget to support my work, or justĀ ignoreĀ STEP 1. Iāve been very honest about this aspect of my work since the beginning: I donāt run any ADS, I donāt require subscriptions, paid or otherwise, I donāt collect IPs, emails, and I donāt have any referral links from Amazon or other merchants. I also donāt have any POP-UPs or COOKIES. I have repeatedly been told over the years how much I have contributed to the community. Itās something I love doing and have been honest about my passion since the beginning. But I also Need The Community to Support me Back to be able to continue doing this work.
STEP 20
Now open your browser and type in https://yourname.ddns.netĀ In my case https://mariudon.ddns.net If everything goes right, you will see the Mastodon login page. Click Login. Follow the instructions in the image below. ā ļøWarning: if you get a 400 Bad Request page that says The plain HTTP request was sent to HTTPS port, this means you have selected the http scheme instead of the https scheme at STEP 16 point 3.
STEP 21
On the E-mail address field type in the email you have chosen at STEP 13. On the Password field type in the password you have previously generated automatically at STEP 14. Click Log in. Follow the instructions in the image below.
STEP 22
Click Preferences to access your Administration area. Follow the instructions in the image below.
STEP 23
Click Preferences then Appearance. Add your own Mastodon instance preferences. Scroll down the page, then click Save to save the settings. Follow the instructions in the image below.
STEP 24
On the left sidebar, click Administration then Dashboard to access your Mastodon Administration page. Follow the instructions in the image below.
STEP 25
Under Administration, click Server Settings to personalize your Mastodon Server. Follow the instructions in the image below.
STEP 26
If a new user will subscribe to your Server, you will find it under Moderation in the Accounts area. Click Accounts. Click on the new user profile. Follow the instructions in the image below.
STEP 27
Click Confirm to confirm the new user. Once the new user is approved, they can start using your Mastodon server. Follow the instructions in the image below.
šNote: The Owners, Administrators, and Moderators can approve new members.
šNote: Just to clarify: Every user who registers a new account on your Mastodon server requires manual approval from the owner, administrators, or moderators to activate their profile. No confirmation email is sent to new users upon registration, as the SMTP email server was not included in the Docker Compose stack configuration to avoid overloading the email server. This setup ensures complete control over new users joining your private Mastodon server. If you prefer new users to receive automatic registration confirmation emails, contact me for assistance.
STEP 28
Your Mastodon instance at a glance!
Enjoy Mastodon on your UGREEEN NAS!
šNote/Update/Container: How to Update Your Docker Containers on UGREEN NAS Using Portainer.
This post was updated on Monday / July 7th, 2025 at 11:20 PM