Installing Mastodon on a CentOS/RHEL server

   Posted by: Dante   in General

The official Mastodon installation guides are all made for Debian-based distros, so here’s a handy production-ready install for CentOS/RHEL (based on nginx):

  1. Enable the NUX repo, so that we can install ffmpeg:
    1. sudo rpm –import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
    2. sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm
  2. Use yum to install these packages: ImageMagick libpqxx-devel libxml2-devel libxslt-devel nodejs ffmpeg file git curl postgresql postgresql-contrib postgresql-server redis gcc gcc-c++ bzip2 openssl-devel readline-devel
  3. sudo npm install -g yarn
  4. Create a user to run the app:
    1. sudo useradd -d /home/mastodon -m -s /bin/bash -U mastodon
  5. Configure Postgres to start at boot and start the service:
    1. sudo systemctl enable postgresql
    2. sudo postgresql-setup initdb
    3. sudo systemctl start postgresql
  6. Create a PGSQL database user:
    1. sudo su – postgres; psql
    2. CREATE USER mastodon CREATEDB;
    3. \q
  7. Follow the guides to install rbenv and rbenv-build for the mastodon user
  8. Once rbenv is ready, run `rbenv install 2.3.1` as the mastodon user
  9. Install mastodon (sudo as mastodon user):
    1. cd ~
      git clone https://github.com/tootsuite/mastodon.git live
      cd live
      gem install bundler
      bundle install –deployment –without development test
      yarn install
  10. Follow the rest of the guide for configuration at Mastodon’s repo, starting from the “Configuration” step
  11. Disable the user mastodon from logging in:
    1. sudo chsh -s /sbin/nologin mastodon

Tags: , ,

This entry was posted on Wednesday, April 5th, 2017 at 11:23 pm and is filed under General. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a reply

Name (*)
Mail (will not be published) (*)