Logo       PBase-Foundation


Installation - Summary

Substitute your email and valid SMTP credentials in the echo commands,
then run the yum commands as detailed below.

echo "myrealemailaddr@myemail.com" > /root/DEFAULT_EMAIL_ADDRESS.txt
echo "mastodon" > /root/DEFAULT_SUB_DOMAIN.txt
echo "smtp.mailgun.org" > /root/DEFAULT_SMTP_SERVER.txt
echo "postmaster@mail.example.com" > /root/DEFAULT_SMTP_USERNAME.txt
echo "ureplac3-w1threalsmtp-pswrd" > /root/DEFAULT_SMTP_PASSWORD.txt
yum -y install https://pbase-foundation.com/pbase-repo.rpm
yum -y install activpb-preconfig-postgres-mastodon
yum -y install pbase-postgres
yum -y install activpb-mastodon

Installation - Step by Step

Here is how to install an instance of the Mastodon federated messaging platform based on the ActivityPub protocol. It assumes your CentOS 8/EL8 host is registered in DNS on a "mastodon" subdomain like mastodon.myexample.com and the installer will use Let's Encrypt to setup HTTPS.

Mastodon requires a working SMTP connection to send user-registration emails. Default values for SMTP and admin email are read from text files like DEFAULT_SMTP_USERNAME.txt under /root.

Step 1: Provide your email address and SMTP credentials by using the echo command to create text files under the /root directory.
This example specifies the mastodon subdomain. But if you wish to serve Mastodon from the root of your domain leave the DEFAULT_SUB_DOMAIN empty. These example SMTP values are based on the popular Mailgun email vendor:

echo "myrealemailaddr@myemail.com" > /root/DEFAULT_EMAIL_ADDRESS.txt
echo "mastodon" > /root/DEFAULT_SUB_DOMAIN.txt
echo "smtp.mailgun.org" > /root/DEFAULT_SMTP_SERVER.txt
echo "postmaster@mail.example.com" > /root/DEFAULT_SMTP_USERNAME.txt
echo "9replac3-w1threalsmtp-pswd4" > /root/DEFAULT_SMTP_PASSWORD.txt

Step 2: Install the pbase-repo package with the command:
yum -y install https://pbase-foundation.com/pbase-repo.rpm

... when it runs, its output will point out the file pbase_repo.json that now holds copies of the defaults.

Step 3: Install the Mastodon dependencies and pre-configuration package with the command:
yum -y install activpb-preconfig-postgres-mastodon

Step 4: It's output will tell you to review pbase_smtp.json in the module-config.d directory:
vi /usr/local/pbase-data/admin-only/module-config.d/pbase_smtp.json

... this file must contain valid outgoing SMTP email server credentials.

Step 5: Install a local database with the pbase-postgres package:
yum -y install pbase-postgres

...or to configure a non-local Postgres instance you must edit pbase_postgres.json in the module-config.d directory instead to provide its connection information.

Step 6: Install the activpb-mastodon package with the command:
yum -y install activpb-mastodon

... it will take a several minutes for the installer to complete this step as it downloads and builds Ruby along with the dependencies used by Mastodon.

It will use Let's Encrypt to generate a certificate for HTTPS connections.
When the activpb-mastodon package completes you should have a full working instance of Mastodon ready to be administered at https://mastodon.myexample.com depending on your domain name.

You must open your Mastodon URL and click 'Sign Up' to create your administrator account to do first-time setup of your instance.


You should secure your server ports with pbase-firewall-enable and lock down SSH access with the pbase-ssh-fail2ban package.

ActivityPub servers need correct time, so if your server doesn't already have NTP/Chrony already running you should sync your clocks with the pbase-timesync-enable package.

yum -y install pbase-firewall-enable
yum -y install pbase-ssh-fail2ban
yum -y install pbase-timesync-enable

Compatibility: EL8/CentOS 8 only

Version 1.0 of the activpb-mastodon package only works with Red Hat EL8 and CentOS 8.
Note: On Red Hat EL 8 you must first enable CodeReadyBuilder repo with:
subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms

Configuration Options

The first and second step of the install initialize the pbase-repo package. It creates the module-config.d directory to hold customizable configuration option files:

The pbase-repo creates this file: pbase_repo.json
it must be edited to set the defaultEmailAddress field with your email.

"pbase_repo": {
"defaultEmailAddress": "myaddress@myexample.com",
"defaultDesktopUsername": "",
"defaultSmtpPassword": "9876543210987654321-87654321",
"defaultSubDomain": ""

The third step of the install is the activpb-preconfig-postgres-mastodon package. It places more default option files described below under the /usr/local/pbase-data/admin-only/module-config.d/ directory.

This is the Mastodon configuration options file: activpb_mastodon.json
These defaults are appropriate for most use cases.

"activpb_mastodon" : {
"mastodonVersion": "",
"port": 3000,
"addNgnixProxy": true,
"urlSubDomain": "mastodon",
"webDomainName": "",
"alternateDomains": "",
"singleUserMode": false,
"authorizedFetch": false,
"limitedFederationMode": false

(Limitations: changing the port or addNgnixProxy field is not implemented in 1.0)

This is the Let's Encrypt configuration options file: pbase_lets_encrypt.json
The emailAddress gets copied from the pbase_repo.json set above. If you wish to change the urlSubDomain field, it must also be changed to the same value in the pbase_lets_encrypt.json file. (If your server is not registered in DNS you should set executeCertbotCmd to false.)

"pbase_lets_encrypt" : {
"enableAutoRenew": true,
"executeCertbotCmd": true,
"urlSubDomain": "mastodon",
"additionalSubDomain": "",
"emailAddress": "yoursysadmin@yourrealmail.com"

(Limitations: the additionalSubDomain field is not implemented in 1.0)

This is the SMTP configuration options file: pbase_smtp.json
The defaults are typical for a client using the popular Mailgun service.
Be sure to set the password field with the correct value from the SMTP provider.

"pbase_smtp" : {
"server": "smtp.mailgun.org",
"port": 587,
"login": "postmaster@mail.example.com",
"password": "myrealsmtppassword",
"authMethod": "plain",
"openSSLVerifyMode": "none"

This is the Postgres configuration options file: pbase_postgres.json
The defaults are typical for a standalone Mastodon server stack with a local Postgres server, and generally will not need to be modified.

But for an external database server this file must be edited. First, set the install field to false and provide the remote Postgres database's connection information.

"pbase_postgres": [
"default": {
"hostName": "localhost",
"port": "5432",
"startService": true,
"enableRemoteAccess": true,
"install": true,
"database": [
"name": "mastodon_production",
"user": "mastodon",
"password": "myrealpostgrespassword",
"characterSet": "UTF8",
"grantCreateDatabase": true

(Limitations: only one database at a time, changing the startService, enableRemoteAccess fields are not implemented in 1.0)

Subdomain name

The default install assumes the 'mastodon' subdomain is configured in DNS. But to configure a subdomain besides 'mastodon' you must edit the urlSubDomain field in both the pbase_lets_encrypt.json and the activpb_mastodon.json files created in step two of the install.

The other option is to have Mastodon for your root domain. In this case, simply set the urlSubDomain fields to an empty string.

More about Mastodon

Visit the Mastodon project at:
Mastodon is a social networking platform where you can...
"Follow friends and discover new ones among more than 4.4M people. Publish anything you want: links, pictures, text, video. All on a platform that is community-owned and ad-free."