User Tools

Site Tools


myhelp:mastodon

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
myhelp:mastodon [2022/11/24 14:27] – created - external edit 127.0.0.1myhelp:mastodon [2026/01/19 09:57] (current) – [Install Mastodon v4.5.4 on Rocky Linux 10] ulrich
Line 1: Line 1:
 I used the instructions from [[https://docs.joinmastodon.org/admin/install/|Mastodon]] and adopted it to fit better for me :) I used the instructions from [[https://docs.joinmastodon.org/admin/install/|Mastodon]] and adopted it to fit better for me :)
  
-====== Install Mastodon on Rocky Linux ======+ 
 +====== Install Mastodon v4.5.4 on Rocky Linux 10 ====== 
 +Enable repos: remi, rpmfusion, epel 
 +<code> 
 +dnf install --nogpgcheck https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(rpm -E %rhel).noarch.rpm -y 
 +/usr/bin/crb enable 
 +dnf install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-$(rpm -E %rhel).noarch.rpm https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-$(rpm -E %rhel).noarch.rpm -y 
 +yum install -y https://rpms.remirepo.net/enterprise/remi-release-10.rpm 
 +</code> 
 + 
 +Install additional RPMS as root: 
 +nodejs, valkey (instead of redis),  
 +<code> 
 +yum install -y bison ca-certificates certbot.noarch ffmpeg.x86_64 file gdbm-devel git ImageMagick.x86_64 iotop jemalloc-devel.x86_64 jemalloc.x86_64 gcc gcc-c++ libffi-devel libicu-devel libidn-devel libxslt-devel.x86_64 libxslt.x86_64 libyaml-devel make ncurses-devel net-tools nodejs24.x86_64 npm postgresql-devel protobuf-c-compiler.x86_64 python3-certbot-nginx.noarch readline-devel.x86_64 readline.x86_64 valkey.x86_64 vips vips-devel 
 +</code> 
 + 
 +Add user mastodon as root 
 +<code> 
 +mkdir /opt/mastodon 
 +useradd -d /opt/mastodon mastodon 
 +chown -R mastodon:mastodon /opt/mastodon/ 
 +</code> 
 + 
 +Prepare the DB 
 +<code> 
 +postgres=# CREATE USER mastodon CREATEDB; 
 +postgres=# \q 
 +</code> 
 + 
 +Install ruby as user mastodon 
 +<code> 
 +git clone https://github.com/rbenv/rbenv.git ~/.rbenv 
 +echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc 
 +echo 'eval "$(rbenv init -)"' >> ~/.bashrc 
 +source ~/.bashrc 
 +git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build 
 +</code> 
 + 
 +Checkout mastodon code as user mastodon 
 +<code> 
 +git clone https://github.com/mastodon/mastodon.git live && cd live 
 +git checkout $(git tag -l | grep '^v[0-9.]*$' | sort -V | tail -n 1) 
 +</code> 
 + 
 +Install Ruby as user mastodon 
 +<code> 
 +RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install 
 +</code> 
 + 
 +Install Ruby dependencies as user mastodon 
 +<code> 
 +bundle config deployment 'true' 
 +bundle config without 'development test' 
 +bundle install 
 +</code> 
 + 
 +Fix some nodejs stuff as root 
 +<code> 
 +npm install -g yarn 
 +rm -f /usr/local/bin/yarn #  when a old yarn version is installed 
 +rm -f /usr/local/bin/yarnpkg #  when a old yarn version is installed 
 +npm install -g corepack 
 +</code> 
 + 
 +Install nodejs dependencies as user mastodon 
 +<code> 
 +corepack enable 
 +corepack prepare yarn@4.12.0 --activate 
 +yarn install 
 +</code> 
 +====== Install Mastodon on Rocky Linux 9 ======
 ===== Pre-requisites ===== ===== Pre-requisites =====
 +Enable EPEL is a good idea 
 +<code>
 +dnf config-manager --set-enabled powertools
 +dnf install epel-release
 +</code>
 +
 +Get the YARN repo 
 +<code>
 +curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
 +</code>
 +
 +Installing the needed packages
 +<code>
 +yum install -y git ruby ruby-devel postgresql-devel postgresql-server postgresql \
 + postgresql-contrib nodejs.x86_64 yarn make idn2.x86_64 libidn-devel.x86_64 \
 + libidn2-devel.x86_64 libidn.x86_64  libicu-devel.x86_64 libicu.x86_64 gcc gcc-c++ \
 + libzstd-devel openssl-devel tar redis nginx certbot.noarch \
 + python3-certbot-nginx.noarch ImageMagick.x86_64 libicu-devel.x86_64 postgresql-contrib.x86_64 \
 + libffi-devel.x86_64 libyaml.x86_64 autoconf.noarch protobuf.x86_64 \
 + libxml2-devel.x86_64 bison.x86_64 libpq-devel.x86_64 jemalloc-devel rbenv
 +</code>
 +
 +Add the user and change the home-dir
 +<code>
 +adduser mastodon
 +mv /home/mastodon /opt
 +usermod -d /opt/mastodon mastodon
 +</code>
 +
 +Start redis
 +<code>systemctl enable --now redis</code>
 +
 +===== Preparing the DB =====
 +<code>
 +systemctl start postgresql.service
 +/usr/bin/postgresql-setup --initdb --unit postgresql
 +sudo -u postgres psql
 +</code>
 +<code>
 +CREATE USER mastodon CREATEDB;
 +\q
 +</code>
 +
 +===== Setting up Mastodon =====
 +<code>
 +su - mastodon
 +</code>
 +
 +Use git to download the latest stable release of Mastodon:
 +<code>
 +git clone https://github.com/tootsuite/mastodon.git live && cd live
 +git checkout $(git tag -l | grep -v 'rc[0-9]*$' | sort -V | tail -n 1)
 +</code>
 +
 +Now to install Ruby and JavaScript dependencies:
 +<code>
 +bundle config deployment 'true'
 +bundle config without 'development test'
 +bundle install -j$(getconf _NPROCESSORS_ONLN)
 +yarn install --pure-lockfile
 +</code>
 +
 +Run the interactive setup wizard:
 +<code>
 +RAILS_ENV=production bundle exec rake mastodon:setup
 +</code>
 +
 +
 +===== Setting up nginx =====
 +Copy the prepared nginx.conf into the nginxc config-dir. Change the hostname and the root-dir.
 +<code>
 +cp /opt/mastodon/live/dist/nginx.conf /etc/nginx/conf.d/mastodon.conf
 +sed -i 's:/home/mastodon/live/public;:/opt/mastodon/live/public;:g' /etc/nginx/conf.d/mastodon.conf
 +sed -i 's/example.com/social.server17.net/g' /etc/nginx/conf.d/mastodon.conf
 +</code>
 +
 +Ensure that the firewall is configured for http and https
 +<code>
 +firewall-cmd --add-service=http --permanent 
 +firewall-cmd --add-service=https --permanent 
 +firewall-cmd --reload
 +</code>
 +
 +Get a certifcate for your host/hostname
 +<code>
 +certbot --nginx -d social.server17.net
 +</code>
 +
 +===== Setting up systemd services =====
 +copy the files
 +<code>
 +cp /opt/mastodon/live/dist/mastodon-*.service /etc/systemd/system/
 +</code>
 +
 +and edit the files
 +<code>
 +sed -i 's:/home/mastodon/:/opt/mastodon/:g' /etc/systemd/system/mastodon-*
 +sed -i 's:/opt/mastodon/.rbenv/shims/bundle:/opt/mastodon/live/bin/bundle:g' /etc/systemd/system/mastodon-*
 +</code>
 +
 +now relaod the systemd and start evertything
 +<code>
 +systemctl daemon-reload
 +systemctl enable --now mastodon-web mastodon-sidekiq mastodon-streaming
 +</code>
 +
 +
 +Maybe something went wrong with the install of the bundler gem and the services are not starting. Check if the gem is installed or just install it. 
 +<code>
 +# su - mastodon
 +cd live/
 +RAILS_ENV=production  gem install bundler
 +</code>
 +
 +
 +====== Tuning ======
 +===== Start tuning sidekiq =====
 +sidekiq is handling multiple queues. Each of them can run as an own process. Per process you should use a max. of 25 threads. 
 +
 +====== OLD HOW TO ======
 +===== Install Mastodon on Rocky Linux 8 =====
 +==== Pre-requisites ====
 Enable EPEL is a good idea  Enable EPEL is a good idea 
 <code> <code>
Line 29: Line 221:
  python3-certbot-nginx.noarch ImageMagick.x86_64 libicu-devel.x86_64 postgresql-contrib.x86_64 \  python3-certbot-nginx.noarch ImageMagick.x86_64 libicu-devel.x86_64 postgresql-contrib.x86_64 \
  libffi-devel.x86_64 libyaml-devel.x86_64 autoconf.noarch protobuf-compiler.x86_64 \  libffi-devel.x86_64 libyaml-devel.x86_64 autoconf.noarch protobuf-compiler.x86_64 \
- libxml2-devel.x86_64 bison.x86_64 libpq-devel.x86_64 jemalloc-devel+ libxml2-devel.x86_64 bison.x86_64 libpq-devel.x86_64 jemalloc-devel rbenv
 </code> </code>
  
Line 39: Line 231:
 </code> </code>
  
-===== Preparing the DB =====+==== Preparing the DB ====
 <code> <code>
 systemctl start postgresql.service systemctl start postgresql.service
Line 50: Line 242:
 </code> </code>
  
-===== Setting up Mastodon =====+==== Setting up Mastodon ====
 <code> <code>
 su - mastodon su - mastodon
Line 74: Line 266:
 </code> </code>
  
-===== Setting up nginx =====+==== Setting up nginx ====
 Copy the prepared nginx.conf into the nginxc config-dir. Change the hostname and the root-dir. Copy the prepared nginx.conf into the nginxc config-dir. Change the hostname and the root-dir.
 <code> <code>
Line 94: Line 286:
 </code> </code>
  
-===== Setting up systemd services =====+==== Setting up systemd services ====
 copy the files copy the files
 <code> <code>
Line 112: Line 304:
 </code> </code>
  
-====== Update Mastodon to 4.0.* ======+ 
 +===== Update Mastodon to 4.0.* =====
 That is just a how-to which worked for me. Do a Backup in advance! That is just a how-to which worked for me. Do a Backup in advance!
-===== Pre-requisites =====+==== Pre-requisites ====
 Backup everything! You do not want to stay up half of the night and fix something.   Backup everything! You do not want to stay up half of the night and fix something.  
  
Line 129: Line 322:
 </code> </code>
 That is necessary, because in my installation I changed it before.  That is necessary, because in my installation I changed it before. 
-===== the REAL update =====+==== the REAL update ====
 Here I just followed the manual from [[https://github.com/mastodon/mastodon/releases/tag/v4.0.0|Mastodon]] on Github.  Here I just followed the manual from [[https://github.com/mastodon/mastodon/releases/tag/v4.0.0|Mastodon]] on Github. 
  
Line 151: Line 344:
  
  
-===== Update to 4.0.2 =====+==== Update to 4.0.2 ====
 <code> <code>
 su - mastodon su - mastodon
Line 162: Line 355:
 YEAH! Welcome to the new version.  YEAH! Welcome to the new version. 
  
-====== Tuning ====== +===== Tuning ===== 
-===== Start tuning sidekiq =====+==== Start tuning sidekiq ====
 sidekiq is handling multiple queues. Each of them can run as an own process. Per process you should use a max. of 25 threads.  sidekiq is handling multiple queues. Each of them can run as an own process. Per process you should use a max. of 25 threads. 
  
  
 +{{tag>[HowTo]}}
myhelp/mastodon.1669300031.txt.gz · Last modified: by 127.0.0.1