Redmineのバージョンを3.2から4.2へバージョンアップを行ったので作業メモ。
RedmineとRuby、Railsのバージョンの関係
Redmineの各バージョンで必要となるRubyとRailsのバージョンは以下の通りです。
Redmine 3.2からRedmine 4.2へバージョンアップするには、そもそもRubyのバージョンアップ、Railsのバージョンアップが必要ですね。
Redmine 3.2から4.2へバージョンアップ手順
データベースのリストア
Redmine 3.2でデータベースをバックアップしたものを、バージョン4.2用のサーバーにリストアします。
同一サーバーでバージョンアップを行うならこの手順は不要です。
データベースを作成
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 2372 Server version: 5.5.40-MariaDB MariaDB Server Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> create database redmine default character set utf8; Query OK, 1 row affected (0.05 sec) MariaDB [(none)]> grant all on redmine.* to redmine@localhost identified by '*****'; Query OK, 0 rows affected (0.39 sec) MariaDB [(none)]> flush privileges; Query OK, 0 rows affected (0.12 sec) MariaDB [(none)]> quit Bye |
データベースをリストアします。
|
# mysql -u redmine -pxxxx -D redmine < redmine.mysqldump |
RVM (Ruby Version Manager) のインストール
RVMは、Rubyのバージョンマネージャです。
・https://rvm.io/
Rubyの最新版2.5をインストールするとうまくインストールが出来なかったので、古いRubyの環境を構築するために、RVMをインストールしてから、Ruby 2.4をインストールします。
|
# curl -sSL https://get.rvm.io | bash # source /etc/profile.d/rvm.sh # rvm reload # rvm list known # ruby --version # rvm use 2.4.10 –default To install do: 'rvm install "ruby-2.4.10"' # rvm install "ruby-2.4.10" # ruby -v ruby 2.4.10p364 (2020-03-31 revision 67879) [x86_64-linux] |
Bundler (Bundle) のインストール
Bundlerとはたくさんのgemのバージョン間の依存関係を解決しながらGemfileに列挙したすべてのgemをインストールしてくれるツールです。
Bundlerの読み方は、バンドラーです。
・https://bundler.io/
bundlerをインストールします。
|
# gem install bundler Fetching: bundler-2.2.16.gem (100%) Successfully installed bundler-2.2.16 1 gem installed |
最新のbundler2.2.16は新し過ぎるので削除します。
代わりに最新ではなくてbundler 1.17.3をインストールする。
|
# gem install bundler -v 1.17.3 # bundle -v Bundler version 1.17.3 # gem list bundler *** LOCAL GEMS *** bundler (default: 1.17.3) bundler-unload (1.0.2) rubygems-bundler (1.4.5) |
Redmine 4.2のインストール
まず、前提ソフトウェアをインストールします。
EPELリポジトリを有効にする
|
# yum install -y epel-release # yum config-manager --set-enabled PowerTools |
ImageMagickをインストールする。
|
# yum install -y ImageMagick ImageMagick-devel |
Redmine 4.2 のインストールを行います。
redmine-4.2.0.tar.gzをダウンロードします。
|
# wget --no-check-certificate https://www.redmine.org/releases/redmine-4.2.0.tar.gz |
ダウンロードしたredmine-4.2.0.tar.gz を /var/lib/redmine に展開します。
その後、/var/lib/redmine/config にある
database.yml
configuration.yml
setting.yml
について、Redmine 3.2の設定を参考に変更します。
configuration.ymlのメール送信設定
|
production: email_delivery: delivery_method: :smtp smtp_settings: enable_starttls_auto: false address: "localhost" # address: "aaa.bbb.ccc" port: 25 domain: "aaa.bbb.ccc" |
権限を変更します。
|
# useradd redmine # chown -R redmine:redmine /var/lib/redmine |
gccとmariadb-develをインストールします。
|
# yum install gcc # yum install mariadb-devel |
Gemパッケージのインストール
bundleを使って必要なGemパッケージをインストールします。
|
# cd /var/lib/redmine # bundle install --without development test --path vendor/bundle # bundle list |
* mysql2 (0.5.3)
* rails (5.2.5)
がインストールされていることを確認する。
でエラーが出ないことを確認する。
passengerのインストール
passengerをインストールします。
|
# gem install passenger -N Fetching: rake-13.0.3.gem (100%) Successfully installed rake-13.0.3 Fetching: rack-2.2.3.gem (100%) Successfully installed rack-2.2.3 Fetching: passenger-6.0.8.gem (100%) Building native extensions. This could take a while... Successfully installed passenger-6.0.8 3 gems installed |
PassengerのApache用モジュールの前提ソフトウェアをインストールします。
|
# yum install libcurl-devel httpd-devel apr-devel apr-util-devel |
PassengerのApache用モジュールのインストールします。
|
# passenger-install-apache2-module |
Redmine3.2から4.2 データベースのアップグレード
Redmine3.2から4.2 データベースのアップグレードを行います。
|
# cd /va/lib/redmine # bundle exec rake generate_secret_token # bundle exec rake db:migrate RAILS_ENV=production # bundle exec rake redmine:plugins:migrate RAILS_ENV=production |
キャッシュのクリアを行います。
|
# bundle exec rake tmp:cache:clear RAILS_ENV=production |
ログのローテート
/etc/logrotate.d/redmine
というファイルを作成します。
中身は次のように記述しておきます。
|
/var/lib/redmine/log/*log { missingok notifempty copytruncate compress } |
以上でRedmine 4.2のセットアップは終わりました。
コメント