How to Install Mastodon on Linux Mint Latest

Mastodon is a free, open-source, decentralized social networking platform that lets people share their thoughts, ideas, and interests with others. In this tutorial, you will learn how to install Mastodon on Linux Mint Latest.

Prerequisites

Before installing Mastodon, you need to complete the following prerequisites:

Step 1: Install Required Dependencies

Before installing Mastodon, it's essential to ensure that your Linux Mint machine is up-to-date and has all the required dependencies. To do this, enter the following commands in the terminal:

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev nodejs yarn pkg-config libpq-dev

Step 2: Install PostgreSQL

Mastodon uses PostgreSQL as its primary database. To install it on your Linux Mint machine, you can use the following commands:

sudo apt-get update
sudo apt-get install postgresql postgresql-contrib libpq-dev

Once the installation is complete, start the PostgreSQL service and enable it to run on system start-up by entering these commands:

sudo systemctl enable postgresql
sudo systemctl start postgresql

Step 3: Install Ruby

Mastodon is written in Ruby, so you need to install it on your machine. You can use the Rbenv tool to manage and install Ruby on your system.

git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL

Install Ruby Build plugin for Rbenv:

git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build

Now, install Ruby:

rbenv install 2.7.3
rbenv global 2.7.3
ruby -v

You should see the Ruby version displayed in the terminal.

Step 4: Install Mastodon

Now that you have installed all the necessary dependencies, it's time to install Mastodon from the GitHub repository. You can use the following commands to clone the Mastodon repository and install it:

cd ~
git clone https://github.com/tootsuite/mastodon.git live
cd live
git checkout $(git tag -l | sort -V | tail -n 1) #(stable branch)
gem install bundler
bundle install --deployment --without development test

Step 5: Configuration

Mastodon requires some initial setup before you can start using it. You need to create a configuration file and set up some environment variables.

cp .env.production.sample .env.production
nano .env.production

Update the file with your instance details:

Parameter Description Example
LOCAL_DOMAIN Your Mastodon instance domain mastodon.example.com
LOCAL_HTTPS Whether HTTPS is used for your instance true
SMTP_SERVER SMTP server for sending emails smtp.gmail.com
SMTP_PORT SMTP server port number 587
SMTP_LOGIN SMTP server login email youremail@gmail.com
SMTP_PASSWORD SMTP server password yourpassword
SMTP_FROM_ADDRESS SMTP email From address youremail@gmail.com
SMTP_TLS Whether SMTP server uses TLS true

Step 6: Initialize the Database

The next step is to initialize the Mastodon PostgreSQL database by running the following command:

RAILS_ENV=production rake db:create db:migrate

Step 7: Compile Assets

Mastodon uses the Yarn package manager to manage front-end dependencies. You need to install it first.

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt install yarn

Compile the assets:

RAILS_ENV=production NODE_ENV=production bundle exec rails assets:precompile

Step 8: Start Mastodon

Once you have completed all the above steps, start the Mastodon service by running the following command:

systemctl enable mastodon-web mastodon-sidekiq mastodon-streaming
systemctl start mastodon-web mastodon-sidekiq mastodon-streaming

After this, Mastodon will be up and running on your domain name. You can now create a new user account and start using Mastodon!

Conclusion

In this tutorial, you learned how to install Mastodon on Linux Mint Latest. Mastodon is an excellent platform for social networking that provides individuals and communities with a great platform for sharing their thoughts and ideas. By following this tutorial, you can have your Mastodon instance up and running quickly and easily.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!