2012年6月8日金曜日

Redmine2.0.1から2.0.2へアップデート

Ruby on Railsの脆弱性が見つかったようでRedmine2.0.2がリリース

Redmine2.0.1を構築したばかりなのに・・・構築はこちらです
でもまだ運用至っていないので、アップデートしちゃいます。
尚、プラグインや外部テーマは一切使用していない状態です。

環境を簡単に説明すると
CentOS6.2(x86)
Apache 2.2.22+Passenger
PostgreSQL9.1.3
※Apache, PostgreSQLはソースからインストール

http://www.redmine.org/projects/redmine/wiki/RedmineUpgradeを参考にアップデート


●Redmine2.0.1のバックアップ

Redmineソース
# mv /home/redmine/public_html /home/redmine/public_html_2.0.1

データベース(PostgreSQL9.1)
データベース名:redmine
ユーザー名:redmine
# /usr/local/pgsql/bin/pg_dump -U redmine -Fc redmine > /home/redmine/public_html_2.0.1/v201_db_`date +%Y%m%d`.dump

v201_db_今日の日付(db_20120608.dump)というスタイルでバックアップファイルが作成されます。


●Redmine2.0.2の配置

ディレクトリの作成
# mkdir /home/redmine/public_html
# chmod 775 /home/redmine/public_html

RedmineはTarボールを利用
ダウンロード先はhttp://rubyforge.org/frs/?group_id=1850を参照
# cd /usr/local/src
# wget http://rubyforge.org/frs/download.php/76189/redmine-2.0.2.tar.gz
# tar zxvf redmine-2.0.2.tar.gz
# mv ./redmine-2.0.2/* /home/redmine/public_html/

設定ファイル等のコピー(プラグインは考慮していない)
# cp /home/redmine/public_html_2.0.1/config/database.yml /home/redmine/public_html/config/

# cp /home/redmine/public_html_2.0.1/config/configuration.yml /home/redmine/public_html/config/

ログ制御
# cp /home/redmine/public_html_2.0.1/config/additional_environment.rb /home/redmine/public_html/config/

添付ファイル # cp /home/redmine/public_html_2.0.1/files/* /home/redmine/public_html/files/

追加したテーマ
# cp -R /home/redmine/public_html_2.2.0/public/themes/farend_fancy /home/redmine/public_html/public/themes/

passengerで稼働しているためApacheユーザーに権限を与える
# chown -R daemon:daemon /home/redmine/public_html

Gemパッケージ(Railsが3.2.5になります)
# cd /home/redmine/public_html
# bundle install --without development test mysql sqlite →DBがPostgreSQLの場合
# bundle install --without development test postgresql sqlite →DBがMySQLの場合
Using rake (0.9.2.2) 
Using i18n (0.6.0) 
Using multi_json (1.3.6) 
Installing activesupport (3.2.5) 
Using builder (3.0.0) 
Installing activemodel (3.2.5) 
Using erubis (2.7.0) 
Using journey (1.0.3) 
Using rack (1.4.1) 
Using rack-cache (1.2) 
Using rack-test (0.6.1) 
Using hike (1.2.1) 
Using tilt (1.3.3) 
Using sprockets (2.1.3) 
Installing actionpack (3.2.5) 
Using mime-types (1.18) 
Using polyglot (0.3.3) 
Using treetop (1.4.10) 
Using mail (2.4.4) 
Installing actionmailer (3.2.5) 
Using arel (3.0.2) 
Using tzinfo (0.3.33) 
Installing activerecord (3.2.5) 
Installing activeresource (3.2.5) 
Using bundler (1.1.4) 
Using coderay (1.0.6) 
Using json (1.7.3) 
Using net-ldap (0.3.1) 
Using pg (0.13.2) 
Using rack-ssl (1.3.2) 
Using rdoc (3.12) 
Installing thor (0.15.2) 
Installing railties (3.2.5) 
Installing rails (3.2.5) 
Using prototype-rails (3.2.1) 
Using ruby-openid (2.1.8) 
Using rack-openid (1.3.1) 
Using rmagick (2.13.1) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

# rake generate_secret_token
# rake db:migrate RAILS_ENV=production 
# rake redmine:plugins:migrate RAILS_ENV=production
# rake tmp:cache:clear
# rake tmp:sessions:clear


passengerで稼働しているためApacheユーザーに権限を与える
# chown -R daemon:daemon /home/redmine/public_html


Apacheの再起動

Redmine 2.0.2 + PostgreSQL

以上で完了

※2.1系、2.2系でも同じ手順で大丈夫と思われます。

<PostgreSQL 参考>
ちなみにバックアップしたデータベースの復元方法です。


データベース名:redmine
ユーザー名:user1
バックアップ名:v202_dbbackup.dump


1.空のデータベースを作成

原則としてrootでは作業できませんので、PostgreSQLを運用しているユーザで行います。(私はpostgresというユーザで運用しています)

# su - postgres

$ createdb redmine --owner=user1 --encoding=UTF8 --template=template0


2.復元

[postgres@localhost]$ pg_restore -d redmine ./v202_dbbackup.dump

これでOKです。
 



Google検索