CentOSだといろいろ無理があるのでfedoraに移行出来ないか確認中。記載内容が正しい保証はないです。
#dnf upgrade
fedoraとCentOSの差分
# firewall-cmd --set-default-zone=public
443の許可
#firewall-cmd --permanent --zone=public --add-port=443/tcp
#firewall-cmd --reload
selinuxの無効化
#vi /etc/selinux/config
SELINUX=disabled
#reboot
fedora42(というかDNF5)ではmodule installは非対応
#dnf install nodejs
dnfでもv22.17がインストールされるがcorepack=yarn4が使えないのでn版に入れ替え
#npm install -g n
#n stable
#dnf remove nodejs
#exec $SHELL -l '再ログイン
#corepack enable
今回は4.3.9なのでImageMagick
#dnf install ImageMagick
CentOSと異なり追加のリポジトリの指定は不要
#dnf install ffmpeg
#dnf install libpq-devel
#dnf install libxml2-devel
#dnf install libxslt-devel
#dnf install git-core
#dnf install gcc-c++
#dnf install protobuf-devel
#dnf install autoconf
#dnf install bison
Development Toolsのインストールは変わった
#dnf install @development-tools
#dnf install libyaml-devel
#dnf install readline-devel
#dnf install libffi-devel
#dnf install gdbm-devel
#dnf install nginx
実際にインストールされるのはvalkey
#dnf install redis
インストールされるのは16 バージョンの指定方法わからんし13ももうすぐEOLになるので16でよし
#dnf install postgresql-server
#dnf install postgresql-contrib
#dnf install libidn-devel
#dnf install libicu-devel
#dnf install jemalloc-devel
#useradd -m -s /bin/bash mastodon
#su - mastodon
$export NODE_OPTIONS="--max-old-space-size=16384"
$git clone https://github.com/rbenv/rbenv.git ~/.rbenv
$echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
$echo 'eval "$(rbenv init -)"' >> ~/.bashrc
$exec bash
$git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
$RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install 3.3.5
$rbenv global 3.3.5
$gem install bundler --no-document
$exit
#systemctl start redis 'StartしていないとSETUPでエラーになる
#export 'PGSETUP_INITDB_OPTIONS=--encoding=UTF-8 --no-locale'
#postgresql-setup initdb
#systemctl start postgresql
#su - postgres
$psql
postgres=#SELECT name, setting, context FROM pg_settings WHERE name LIKE 'lc%'; --setting列がCであることを確認
postgres=#CREATE USER mastodon CREATEDB;
postgres=#\q
$exit
#su - mastodon
$export NODE_OPTIONS="--max-old-space-size=16384"
$git clone https://github.com/mastodon/mastodon.git live && cd live
[live]$git checkout v4.3.9
[live]$bundle config deployment 'true'
[live]$bundle config without 'development test'
[live]$bundle install -j$(getconf _NPROCESSORS_ONLN)
[live]$yarn install
! Corepack is about to download https://repo.yarnpkg.com/4.5.0/packages/yarnpkg-cli/bin/yarn.js
? Do you want to continue? [Y/n] y
[live]$RAILS_ENV=production bundle exec rake mastodon:setup
Domain name:192.168.0.7 'VMのサーバーでドメインなしなので
single user mode:y 'お一人様
Docker:n '非Docker
PostgreSQL host:(enter)
PostgreSQL port:(enter)
PostgreSQL database:(enter)
PostgreSQL user:(enter)
Password of PostgreSQL user:(enter)
Resis host:(enter)
Redis port:(enter)
Redis password:(enter)
Do you want to store uploaded files on the cloud?:n
Do you want to send e-mails from localhost?:n
SMTP server:(enter)
SMTP port:(enter)
SMTP username:(enter)
SMTP password:(enter)
SMTP authentication:(enter)
SMTP OpenSSL verify mode:(enter)
Enable STARTTLS:(enter)
E-mail address to send e-mails "from":(enter)
Send a test e-mail with this configuration right now?:n
Do you want Mastodon to periodically check for important updates and notify you?:y
This configuration will be written to .env.production
Save configuration?:y
Now that configuration is saved, the database schema must be loaded.
If the database already exists, this will erase its contents.
Prepare the database now? (Y/n):y
Compile the assets now?:y
Do you want to create an admin user straight away?:y
Username:(enter)
E-mail:一応何かのメールアドレス(ログイン時に使う)
You can login with the password: ログインパスワードなので控えておく
$exit
ドメインなしなので俺々証明書の作成
#mkdir /etc/nginx/ssl
#openssl genrsa -out /etc/nginx/ssl/server.key 2048
#openssl req -new -key /etc/nginx/ssl/server.key -out /etc/nginx/ssl/server.csr
Country Name (2 letter code) [XX]:JP
State or Province Name (full name) []:Tokyo
Locality Name (eg, city) [Default City]:(enter)
Organization Name (eg, company) [Default Company Ltd]:(enter)
Organizational Unit Name (eg, section) []:(enter)
Common Name (eg, your name or your server's hostname) []:(enter)
Email Address []:(enter)
A challenge password []:(enter)
An optional company name []:(enter)
#openssl x509 -days 3650 -req -signkey /etc/nginx/ssl/server.key -in /etc/nginx/ssl/server.csr -out /etc/nginx/ssl/server.crt
nginxの設定
#cp /home/mastodon/live/dist/nginx.conf /etc/nginx/conf.d
#vi /etc/nginx/conf.d/nginx.conf
server_name 192.168.0.7 'VMのサーバーでドメインなしなので
ssl_certificate /etc/nginx/ssl/server.crt; 'さっき作った俺々証明書
ssl_certificate_key /etc/nginx/ssl/server.key; 'さっき作った俺々証明書
RedHat系はnginxのユーザーをmastodonにする必要あり
#vi /etc/nginx/nginx.conf
user mastodon;
#chown -R mastodon:root /var/lib/nginx
設定情報のコピー
#cp /home/mastodon/live/dist/mastodon-*.service /etc/systemd/system/
#ln -s /usr/local/bin/node /usr/bin/node 'どこかでnodeのパスが/usr/bin/nodeになってた
再起動して動作確認
#systemctl daemon-reload '設定情報の適用
#systemctl enable mastodon-web.service
#systemctl enable mastodon-sidekiq.service
#systemctl enable mastodon-streaming.service
#systemctl enable nginx
#systemctl enable redis
#systemctl enable postgresql
#reboot
#systemctl status mastodon-*