Redmine のアップグレード全手順(1.2.3 → 2.2.2) その1

これまで旧バージョンを使用していましたが、2013年1月21日にリリースされた最新版 Redmine 2.2.2 にアップグレードしました。

アップグレードは、「旧バージョンからのアップグレード手順」(Redmine.JP)にしたがって進めました。ここではその全手順を紹介します。

1.バックアップ
1.1.filesディレクトリのバックアップ

ここでは、Redmine のホームディレクトリを丸ごとコピーしてしまいます。

[root ~]# cd /var/lib
[root ~]# mv ./redmine ./redmine.bak
1.2.MySQLデータベースのバックアップ

MySQL のコマンドを使用して、バックアップを取ります。データベース名に redmine を指定します。

[root ~]# mysqldump -u root redmine | gzip > /root/backup/mysqldump/mysql
dump_redmine_`date +%Y%m%d%H%M`.sql.gz
2.アップグレードの実行(tar.gzをダウンロードする場合)
2.1.Redmineのダウンロードと展開

任意のディレクトリで、Redmineのtarballを新しいディレクトリに展開します。
ここでは、現行の redmineディレクトリ を redmine.bakディレクトリに名称変更して保存しておくことにします。

[root ~]# wget http://rubyforge.org/frs/download.php/76722/redmine-2.2.2.tar.gz
[root ~]# tar xvfz redmine-2.2.2.tar.gz
[root ~]# mv /var/lib/redmine /var/lib/redmine.bak
[root ~]# mv ./redmine-2.2.2 /var/lib/redmine

redomineディレクトリの所有者を変更します。

[root ~]# cd /var/lib
[root ~]# ll
drwxrwxr-x 16   1000    1000     4096  1月 21 05:05 redmine
[root ~]# chown -R root:root ./redmine
[root ~]# ll
drwxrwxr-x 16 root   root        4096  1月 21 05:05 redmine
2.2.データベース設定ファイルのコピー

データベース設定ファイル config/database.yml を新しい config ディレクトリにコピーします。

[root ~]# cp -p /var/lib/redmine.bak/config/database.yml /var/lib/redmine/config/.
2.3.files ディレクトリのコピー

files ディレクトリに格納されているファイルを、新しいRedmineのディレクトリにコピーします。

[root ~]# cp -p ./redmine.bak/files/* ./redmine/files/.
2.4.プラグインのコピー

独自に追加したプラグインを新しいRedmineのディレクトリにコピーしますが、ここでは割愛します。

2.5.セッション管理用秘密鍵の作成

Redmineのインストールディレクトリに移動して、セッション管理用秘密鍵の作成を行います。

[root ~]# cd /var/lib/redmine
[root ~]# rake generate_session_store
Could not find gem 'mocha (= 0.12.3) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.

このようなエラーが出ましたので、以下を実行してみます。

[root ~]# gem install mocha -v 0.12.3
Fetching: metaclass-0.0.1.gem (100%)
Fetching: mocha-0.12.3.gem (100%)
Successfully installed metaclass-0.0.1
Successfully installed mocha-0.12.3
2 gems installed
Installing ri documentation for metaclass-0.0.1...
Installing ri documentation for mocha-0.12.3...
Installing RDoc documentation for metaclass-0.0.1...
Installing RDoc documentation for mocha-0.12.3...

インストールは成功しました。
改めてセッション管理用秘密鍵の作成を実行してみます。

[root ~]# rake generate_session_store
Could not find gem 'rmagick (>= 2.0.0) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.

次はこのようなエラーが出ました。
ここで、ImageMagick をインストールしてみます。

[root ~]# yum install ImageMagick.x86_64
(略)
Installed:
  ImageMagick.x86_64 0:6.2.8.0-15.el5_8
(略)
Complete!

次に、rmagick のバージョン2.0.0をインストールします。

[root ~]# gem install rmagick -v 2.0.0
Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
        ERROR: Failed to build gem native extension.

        /usr/local/bin/ruby extconf.rb
extconf.rb:2: command not found: Magick-config --version
checking for Ruby version >= 1.8.2... yes
checking for Magick-config... no
Can't install RMagick 2.0.0. Can't find Magick-config in /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/local/bin/ruby


Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/rmagick-2.0.0 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.8/gems/rmagick-2.0.0/ext/RMagick/gem_make.out

失敗です。Magick-config が見つからないということです。
これに対処するために、ImageMagick-devel をインストールします。

[root ~]# yum install ImageMagick-devel.x86_64
(略)
Installed:
  ImageMagick-devel.x86_64 0:6.2.8.0-15.el5_8
(略)
Complete!

インストールは成功です。
この先は次の投稿「Redmine のアップグレード全手順(1.2.3 → 2.2.2) その2」で。

Comments are closed.