Mastodon is free and open-source CMS software that let you create your social networking website. It is written in Ruby and JavaScript with support on multiple platforms. Similar to Twitter and Facebook, Mastodon offers microblogging features that allow users to post messages, including images, follow others and create other content. You can self-host Mastodon on your server in your environment. Your users can interact with your server via mobile devices, including Android, macOS and others.
How to Install Mastodon Social Network CMS on Ubuntu Linux
As described above, Mastodon is free and open-source CMS-based software that let you create your social networking portal. The app is written in Ruby and JavaScript with support on multiple platforms. Below is how to install it on Ubuntu Linux.
Install dependencies
First, prepare and install package dependencies that will allow you to install and run Mastodon. Run the commands below to update Ubuntu and install dependencies for Mastodon. Once you have installed the packages above, continue below.
Install Node.js and Yarn
Mastodon is written in JavaScript (Node.js). It requires Node.js to be installed. Run the commands below to install it. Add the Node.js repository to Ubuntu by running the commands below. After that, run the commands below to install Node.js. Additional Node.js resources can be found in the post below. How to install Node.js on Ubuntu Linux After installing Node.js, go and also install Yarn. Run the commands below to add Yarn’s repository GPG key and file. Finally, run the commands below to update the Ubuntu package index and install Yarn. Additional Yarn resources can be found in the post below: How to install Yarn on Ubuntu Linux
Install PostgreSQL
Mastodon needs a database server to store its content. It uses the PostgreSQL database server for that. Run the commands below to install PostgreSQL. After installing, log on to PostgreSQL database shell. On the command shell, run the commands below to create a user named mastodon. Exit twice. Additional resources on PostgreSQL can be found in the post below. How to install PostgreSQL on Ubuntu Linux.
Install Ruby
Again, Mastodon is developed in Ruby on Rails. It needs Ruby installed to function. We will create a system account to create an environment to run Ruby. Run the commands below to create a system account named mastodon. Next, switch to the account by typing the commands below. Then create a Ruby environment. Finally, install Ruby and update dependencies.
Install Mastodon
At this point, your system should be ready for Mastodon. Run the commands below to switch to the Mastodon account. The clone is the latest version of Mastodon. Next, install all dependencies. Set up Mastodon by running the commands below. Answer the questions to the prompts as shown below. You’ll be prompted to create an admin account. Do it. Exit when all is done above.
Create a Systemd Service for Mastodon
To efficiently manage the Mastodon service, you will want to create a systemd service for it. Run the commands below to copy pre-configured scripts to use. Reload systemd daemon Now you should be able to start all necessary Mastodon services.
Setup Nginx reverse proxy for Mastodon
Mastodon is SSL enabled by default. You must set up a SSL certificate to use with Mastodon. You can use Let’s Encrypt free SSL with Mastodon, and below is how to do it. Run the commands below to install Certbot and Nginx HTTP server. For additional resources on installing and creating Let’s Encrypt SSL certificates for Nginx, read the post below. How to set up Let’s Encrypt SSL certificate for Nginx on Ubuntu Linux After installing, run the commands below to use Mastodon’s default Nginx server block config setting to create the Nginx server block. If you can’t get the Let’s Encrypt SSL certificate on your localhost, simply use the default Ubuntu snakeoil certificate in the Nginx server block file at /etc/nginx/sites-available/mastodon.conf. Give Nginx permission to Mastodon’s directory and restart. Once you’re done, Mastodon should be installed and ready. Open your browser and browse to the domain name specified in the Nginx server block file. Log in with the Mastodon account created above. That should do it! Conclusion: This post showed you how to install and use Mastodon social network CMS on Ubuntu Linux. If you find any error above or have something to add, please use the comment form below.