Redmineをローカルで弄ってみるかと思ったけど、公式の手順通りだと動かなかったのでメモ(当然手順を追えていないだけの可能性はある)
公式手順:https://www.redmine.org/projects/redmine/wiki/redmineinstall
環境
- Ubuntu 22.04 LTS Server版
- DBにPostgreSQL
- インストールするのはRedmine 5.0
手順について
- とりあえず全部コピペして動かせばRedmineが動く
- 実行ユーザーは最低でもsudoersに必要な権限が乗っていること
Ubuntuなら通常は初期ユーザーでOK - 「redmine」というユーザーを作成するので、既に居る場合は書き換える
- 多分余計な手順も入っていると思う
以下手順という名前のスクリプト
# 設定
# DBパスワード
db_password=my_password
# 依存関係のインストール
sudo apt install subversion -y
sudo apt install ruby ruby-dev -y
sudo apt install build-essential -y
sudo apt install libpq-dev -y
sudo apt install postgresql -y
# ユーザーの追加
sudo adduser redmine --disabled-password --gecos ""
# DBセットアップ
sudo -u postgres psql -c "CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD '$db_password' NOINHERIT VALID UNTIL 'infinity';"
sudo -u postgres psql -c "CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;"
sudo -u redmine psql -U redmine -d redmine -c "CREATE SCHEMA redmine;"
sudo systemctl restart postgresql
# 環境構築
sudo -u redmine svn co https://svn.redmine.org/redmine/branches/5.0-stable /home/redmine/redmine-5.0
echo "
production:
adapter: postgresql
database: redmine
host: localhost
username: redmine
password: \"$db_password\"
encoding: utf8
schema_search_path: redmine
" | sudo -u redmine tee /home/redmine/redmine-5.0/config/database.yml
sudo gem install bundler
sudo -u redmine sh -c "cd /home/redmine/redmine-5.0; bundle config set --local without 'development test'"
sudo -u redmine sh -c "cd /home/redmine/redmine-5.0; bundle config set --local path 'vendor/bundle'"
sudo -u redmine sh -c "cd /home/redmine/redmine-5.0; bundle install"
sudo -u redmine sh -c "cd /home/redmine/redmine-5.0; bundle exec rake generate_secret_token"
sudo -u redmine sh -c "cd /home/redmine/redmine-5.0; RAILS_ENV=production bundle exec rake db:migrate"
sudo -u redmine sh -c "cd /home/redmine/redmine-5.0; RAILS_ENV=production REDMINE_LANG=ja bundle exec rake redmine:load_default_data"
sudo -u redmine sh -c "cd /home/redmine/redmine-5.0; mkdir -p tmp tmp/pdf public/plugin_assets"
sudo -u redmine sh -c "cd /home/redmine/redmine-5.0; chown -R redmine:redmine files log tmp public/plugin_assets"
sudo -u redmine sh -c "cd /home/redmine/redmine-5.0; chmod -R 755 files log tmp public/plugin_assets"
sudo -u redmine sh -c "cd /home/redmine/redmine-5.0; find files log tmp public/plugin_assets -type f -exec chmod -x {} +"
# 検証用サーバーの起動など
sudo gem install webrick
sudo -u redmine sh -c "cd /home/redmine/redmine-5.0; bundle add webrick"
sudo apt install imagemagick -y
sudo apt install libmagickwand-dev -y
sudo -u redmine sh -c "cd /home/redmine/redmine-5.0; bundle add rmagick"
sudo -u redmine sh -c "cd /home/redmine/redmine-5.0; bundle exec rails s -e production"