2011年10月1日土曜日

Ruby1.9.2p290にRedmine1.2.1インストールしてみたが…

■前提
OS: CentOS5.7(64bit)
Ruby: 1.9.2p290
MySQL: 5.0.77(OSバンドルのものを使用)
Apache: 2.2.3(OSバンドルのものを使用)
passenger: 3.0.9


■Redmineを実行するために必要なgemパッケージおよびそのバージョンをインストール
⇒Rack 1.1.1、rake 0.8.7、i18n 0.4.2 (最新バージョンだと動かないため)
⇒バージョン確認
[root@redmine02 ~]# gem list | grep -e rack -e rake -e i18n
i18n (0.6.0)
rack (1.3.3)
rack-cache (1.0.3)
rack-mount (0.8.3)
rack-ssl (1.3.2)
rack-test (0.6.1)
rake (0.9.2, 0.8.7)

⇒Rack 1.1.1インストール
[root@redmine02 ~]# gem install rack -v=1.1.1 --no-rdoc --no-ri
Successfully installed rack-1.1.1
1 gem installed
[root@redmine02 ~]#

⇒i18n 0.4.2
[root@redmine02 ~]# gem install i18n -v=0.4.2 --no-rdoc --no-ri
Successfully installed i18n-0.4.2
1 gem installed
[root@redmine02 ~]#


■MySQLのデフォルトキャラクタセットをutf8に設定
[root@redmine02 ~]# mysql --version
mysql  Ver 14.12 Distrib 5.0.77, for redhat-linux-gnu (x86_64) using readline 5.1

[root@redmine02 ~]# cat /etc/my.cnf
[root@redmine02 ~]# cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
# symbolic-links=0

# 20110930 for redmine		←追記
default-character-set=utf8	←追記

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

# 20110930 for redmine		←追記
[mysql]				←追記
default-character-set=utf8	←追記
[root@redmine02 ~]#

⇒MySLQ再起動
[root@redmine02 ~]# /etc/init.d/mysqld restart
MySQL を停止中:                                            [  OK  ]
MySQL を起動中:                                            [  OK  ]

⇒キャラクタセット設定確認
[root@redmine02 ~]# mysql -u root
mysql> show variables like 'character_set%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | utf8                       |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | utf8                       |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)


■MySQLデータベース準備
⇒匿名ユーザー削除
mysql> use mysql
Database changed
mysql> delete from user where user = '';
Query OK, 2 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

⇒Redmine用データベースとユーザーの作成
mysql> create database db_redmine default character set utf8;
Query OK, 1 row affected (0.06 sec)

mysql> grant all on db_redmine.* to user_redmine identified by 'ienaiyo';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye

⇒自動起動設定
[root@redmine02 ~]# chkconfig --list mysqld
mysqld          0:off   1:off   2:off   3:off   4:off   5:off   6:off
[root@redmine02 ~]# chkconfig mysqld on
[root@redmine02 ~]# chkconfig --list mysqld
mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off


■Redmineのダウンロード
http://rubyforge.org/frs/?group_id=1850
上記サイトよりredmine-1.2.1.tar.gzをダウンロード
/home/public/src/に配置


■Redmineの配置先のディレクトリに解凍
[root@redmine02 ~]# tar -zxf /home/public/src/redmine-1.2.1.tar.gz -C /rails_projects/
[root@redmine02 ~]# cd /rails_projects/redmine-1.2.1/


■Redmine設定
⇒database.ymlの設定
[root@redmine02 redmine-1.2.1]# vi config/database.yml
[root@redmine02 redmine-1.2.1]# cat config/database.yml
production:
  adapter: mysql2
  database: db_redmine
  host: localhost
  username: user_redmine
  password: ienaiyo
  encoding: utf8
[root@redmine02 redmine-1.2.1]#

⇒configuration.ymlの設定
[root@redmine02 redmine-1.2.1]# cp config/configuration.yml.example config/configuration.yml
[root@redmine02 redmine-1.2.1]# vi config/configuration.yml
[root@redmine02 redmine-1.2.1]# tail -11 config/configuration.yml
production:
  email_delivery:		←追記
    delivery_method: :smtp	←追記
    smtp_settings:		←追記
      address: "localhost"	←追記
      port: 25			←追記
      domain: 'dynalias.net'	←追記(環境により異なる)

# specific configuration options for development environment
# that overrides the default ones
development:
[root@redmine02 redmine-1.2.1]#

⇒Redmineの初期設定とデータベースのテーブル作成
[root@redmine02 redmine-1.2.1]# rake generate_session_store
(in /rails_projects/redmine-1.2.1)

[root@redmine02 redmine-1.2.1]# rake db:migrate RAILS_ENV=production
(in /rails_projects/redmine-1.2.1)
rake aborted!
undefined method `map' for nil:NilClass
/usr/local/lib/ruby/1.9.1/rubygems.rb:228:in `activate'
/usr/local/lib/ruby/1.9.1/rubygems.rb:1119:in `try_activate'
:32:in `rescue in require'
:29:in `require'
/rails_projects/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:182:in `block in require'
/rails_projects/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:547:in `new_constants_in'
/rails_projects/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:182:in `require'


■エラー対応
最新バージョンをアンインストール
[root@redmine02 ~]# gem uninstall rack

Select gem to uninstall:
 1. rack-1.1.1
 2. rack-1.3.3
 3. All versions
> 2

You have requested to uninstall the gem:
        rack-1.3.3
sprockets-2.0.0 depends on [rack (~> 1.0)]
actionpack-3.1.0 depends on [rack (~> 1.3.2)]
rack-mount-0.8.3 depends on [rack (>= 1.0.0)]
passenger-3.0.9 depends on [rack (>= 0)]
rack-test-0.6.1 depends on [rack (>= 1.0)]
rack-ssl-1.3.2 depends on [rack (>= 0)]
rack-cache-1.0.3 depends on [rack (>= 0.4)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn]  y
Successfully uninstalled rack-1.3.3

[root@redmine02 redmine-1.2.1]# gem uninstall i18n

Select gem to uninstall:
 1. i18n-0.4.2
 2. i18n-0.6.0
 3. All versions
> 2

You have requested to uninstall the gem:
        i18n-0.6.0
mail-2.3.0 depends on [i18n (>= 0.4.0)]
actionpack-3.1.0 depends on [i18n (~> 0.6)]
activemodel-3.1.0 depends on [i18n (~> 0.6)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn]  y
Successfully uninstalled i18n-0.6.0
[root@redmine02 redmine-1.2.1]#

⇒environment.rbに追記
[root@redmine02 redmine-1.2.1]# head -30 config/environment.rb
# Be sure to restart your web server when you modify this file.

# Uncomment below to force Rails into production mode when
# you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production'

# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.11' unless defined? RAILS_GEM_VERSION

# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')

# add 20110930
if Gem::VERSION >= "1.3.6"
    module Rails
        class GemDependency
            def requirement
                r = super
                (r == Gem::Requirement.default) ? nil : r
            end
        end
    end
end

# Load Engine plugin if available
begin
  require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot')
rescue LoadError
  # Not available
end


⇒エラー解消せず。(T-T)
結局Redmine1.2.1は現時点で最新のruby1.9.2には対応していないことが原因の模様。

0 件のコメント:

コメントを投稿