2012年2月15日水曜日

CentOS6.2 Redmine1.3.1構築メモ(2)

CentOS6.2にRedmine1.3.1を構築する手順をまとめてみました。
 Step1. パッケージおよびインストーラの準備
 Step2. MySQLの準備
 Step3. Ruby Enterprise Edition インストール
 Step4. Redmine インストール
 Step5. ApacheにPassenger組込み

■構成情報
・OS:        CentOS6.2(64bit)
・MySQL:     5.1.52(OSバンドル)
・Ruby:      1.8.7(Ruby Enterprise Editionを利用)
 ・rack:    1.1.2
 ・rake:    0.9.2
 ・i18n:    0.4.2
・gem:       1.6.2
・Apache:    2.2.15(OSバンドル)
・Passenger: 3.0.11
・Redmine:   1.3.1


Step3. Ruby Enterprise Edition インストール
■OSバンドルのRuby有無確認
[root@redmine ~]# rpm -qa | grep ruby
[root@redmine ~]#
→既存Rubyは存在しないのでOK!


■プロキシ環境対応
[root@redmine ~]# export HTTP_PROXY=http://tanyao:xxxxxxx@proxy.kuitan.net:8080


■インストール
⇒インストール前確認
[root@redmine ~]# ll /usr/local/
合計 40
drwxr-xr-x. 2 root root 4096  9月 23 20:50 2011 bin
drwxr-xr-x. 2 root root 4096  9月 23 20:50 2011 etc
drwxr-xr-x. 2 root root 4096  9月 23 20:50 2011 games
drwxr-xr-x. 2 root root 4096  9月 23 20:50 2011 include
drwxr-xr-x. 2 root root 4096  9月 23 20:50 2011 lib
drwxr-xr-x. 3 root root 4096  2月  7 02:22 2012 lib64
drwxr-xr-x. 2 root root 4096  9月 23 20:50 2011 libexec
drwxr-xr-x. 2 root root 4096  9月 23 20:50 2011 sbin
drwxr-xr-x. 6 root root 4096  2月  7 02:22 2012 share
drwxr-xr-x. 2 root root 4096  9月 23 20:50 2011 src
[root@redmine ~]#

⇒解凍&インストール
[root@redmine src]# tar -zxf ruby-enterprise-1.8.7-2012.01.tar.gz
[root@redmine src]# cd ruby-enterprise-1.8.7-2012.01
[root@redmine ruby-enterprise-1.8.7-2012.01]# ./installer --dont-install-useful-gems --no-dev-docs
Welcome to the Ruby Enterprise Edition installer
This installer will help you install Ruby Enterprise Edition 1.8.7-2012.01.
Don't worry, none of your system files will be touched if you don't want them
to, so there is no risk that things will screw up.

You can expect this from the installation process:

  1. Ruby Enterprise Edition will be compiled and optimized for speed for this
     system.
  2. Ruby on Rails will be installed for Ruby Enterprise Edition.
  3. You will learn how to tell Phusion Passenger to use Ruby Enterprise
     Edition instead of regular Ruby.

Press Enter to continue, or Ctrl-C to abort.

Checking for required software...

 * Non-broken C compiler... found at /usr/bin/gcc
 * Non-broken C++ compiler... found at /usr/bin/g++
 * The 'make' tool... found at /usr/bin/make
 * The 'patch' tool... found at /usr/bin/patch
 * Zlib development headers... found
 * OpenSSL development headers... found
 * GNU Readline development headers... found
--------------------------------------------
Target directory

Where would you like to install Ruby Enterprise Edition to?
(All Ruby Enterprise Edition files will be put inside that directory.)

[/opt/ruby-enterprise-1.8.7-2012.01] : /usr/local
--------------------------------------------
Compiling and optimizing the memory allocator for Ruby Enterprise Edition
In the mean time, feel free to grab a cup of coffee.
(中略 約2分)

Ruby Enterprise Edition is successfully installed!
If want to use Phusion Passenger (http://www.modrails.com) in combination
with Ruby Enterprise Edition, then you must reinstall Phusion Passenger against
Ruby Enterprise Edition, as follows:

  /usr/local/bin/passenger-install-apache2-module

Make sure you don't forget to paste the Apache configuration directives that
the installer gives you.


If you ever want to uninstall Ruby Enterprise Edition, simply remove this
directory:

  /usr/local

If you have any questions, feel free to visit our website:

  http://www.rubyenterpriseedition.com

Enjoy Ruby Enterprise Edition, a product of Phusion (www.phusion.nl) :-)
[root@redmine ruby-enterprise-1.8.7-2012.01]#

⇒インストール後
[root@redmine ~]# ll /usr/local/
合計 40
drwxr-xr-x. 2 root root 4096  2月  8 11:38 2012 bin
drwxr-xr-x. 2 root root 4096  9月 23 20:50 2011 etc
drwxr-xr-x. 2 root root 4096  9月 23 20:50 2011 games
drwxr-xr-x. 2 root root 4096  9月 23 20:50 2011 include
drwxr-xr-x. 3 root root 4096  2月  8 11:38 2012 lib
drwxr-xr-x. 3 root root 4096  2月  7 02:22 2012 lib64
drwxr-xr-x. 2 root root 4096  9月 23 20:50 2011 libexec
drwxr-xr-x. 2 root root 4096  9月 23 20:50 2011 sbin
drwxr-xr-x. 6 root root 4096  2月  7 02:22 2012 share
drwxr-xr-x. 2 root root 4096  9月 23 20:50 2011 src
[root@redmine ~]#

⇒バージョン確認
[root@redmine ~]# ruby -v
ruby 1.8.7 (2011-12-28 MBARI 8/0x6770 on patchlevel 357) [x86_64-linux], MBARI 0x6770, Ruby Enterprise Edition 2012.01


■gemパッケージのインストール
⇒Rack 1.1.2のインストール
[root@redmine ~]# gem install rack -v=1.1.2 --no-rdoc --no-ri
Fetching: rack-1.1.2.gem (100%)
Successfully installed rack-1.1.2
1 gem installed

⇒rake 0.9.2のインストール
[root@redmine ~]# gem install rake -v=0.9.2 --no-rdoc --no-ri
Fetching: rake-0.9.2.gem (100%)
Successfully installed rake-0.9.2
1 gem installed

⇒i18n 0.4.2のインストール
[root@redmine ~]# gem install i18n -v=0.4.2 --no-rdoc --no-ri
Fetching: i18n-0.4.2.gem (100%)
Successfully installed i18n-0.4.2
1 gem installed

⇒RMagickのインストール
[root@redmine ~]# gem install rmagick --no-rdoc --no-ri
Fetching: rmagick-2.13.1.gem (100%)
Building native extensions.  This could take a while...
Successfully installed rmagick-2.13.1
1 gem installed

⇒RDocのインストール
[root@redmine ~]# gem install rdoc --no-ri --no-rdoc
Fetching: json-1.6.5.gem (100%)
Building native extensions.  This could take a while...
Fetching: rdoc-3.12.gem (100%)
Depending on your version of ruby, you may need to install ruby rdoc/ri data:

<= 1.8.6 : unsupported
 = 1.8.7 : gem install rdoc-data; rdoc-data --install
 = 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!
Successfully installed json-1.6.5
Successfully installed rdoc-3.12
2 gems installed

⇒Ruby用MySQLドライバのインストール
[root@redmine ~]# gem install mysql --no-rdoc --no-ri
Fetching: mysql-2.8.1.gem (100%)
Building native extensions.  This could take a while...
Successfully installed mysql-2.8.1
1 gem installed

⇒確認
[root@redmine ~]# gem list

*** LOCAL GEMS ***

i18n (0.4.2)
json (1.6.5)
mysql (2.8.1)
rack (1.1.2)
rake (0.9.2)
rdoc (3.12)
rmagick (2.13.1)
[root@redmine ~]#


Step4. Redmine インストール
■インストール(解凍するだけ)
⇒/optに解凍
[root@redmine src]# tar -zxf redmine-1.3.1.tar.gz -C /opt/


■Redmine関連ファイル設定
⇒database.yml作成
[root@redmine src]# cd /opt/redmine-1.3.1/
[root@redmine redmine-1.3.1]# vi config/database.yml
[root@redmine redmine-1.3.1]# cat config/database.yml
production:
  adapter: mysql
  database: db_redmine
  host: localhost
  username: user_redmine
  password: ienaiyo
  encoding: utf8
[root@redmine redmine-1.3.1]#

⇒configuration.ymlの設定
[root@redmine redmine-1.3.1]# cp config/configuration.yml.example config/configuration.yml
[root@redmine redmine-1.3.1]# vi config/configuration.yml
[root@redmine redmine-1.3.1]# tail -11 config/configuration.yml
production:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: "localhost"
      port: 25
      domain: 'kuitan.net'

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

⇒Redmineの初期設定とデータベースのテーブル作成
[root@redmine redmine-1.3.1]# rake generate_session_store
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /opt/redmine-1.3.1/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:21.
NOTE: Gem::SourceIndex#initialize is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#initialize called from /opt/redmine-1.3.1/config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:100.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
(中略)
[root@redmine redmine-1.3.1]#

[root@redmine redmine-1.3.1]# rake db:migrate RAILS_ENV=production
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /opt/redmine-1.3.1/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:21.
NOTE: Gem::SourceIndex#initialize is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#initialize called from /opt/redmine-1.3.1/config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:100.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
(中略)
Missing these required gems:
  rubytree  >= 0

You're running:
  ruby 1.8.7.357 at /usr/local/bin/ruby
  rubygems 1.8.15 at /usr/local/lib/ruby/gems/1.8, /root/.gem/ruby/1.8

Run `rake gems:install` to install the missing gems.
[root@redmine redmine-1.3.1]#

[root@redmine redmine-1.3.1]# gem -v
1.8.15
→gemのバージョンが高すぎることが問題のようだ。

⇒gemのバージョンを1.7.1にダウングレード
[root@redmine ~]# gem update --system 1.7.1
Updating rubygems-update
Fetching: rubygems-update-1.7.1.gem (100%)
Successfully installed rubygems-update-1.7.1
Installing RubyGems 1.7.1
RubyGems 1.7.1 installed

=== 1.7.1 / 2011-03-32

* 1 bug fix:
  * Fixed missing file in Manifest.txt.  (Also a bug in hoe was fixed where
    `rake check_manifest` showing a diff would not exit with an error.)


-----------------------------------------------------------------

RubyGems installed the following executables:
        /usr/local/bin/gem

RubyGems system software updated
[root@redmine ~]# gem -v
1.7.1
[root@redmine ~]#

[root@redmine redmine-1.3.1]# rake generate_session_store
NOTE: SourceIndex.new(hash) is deprecated; From /opt/redmine-1.3.1/config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:100:in `new'.
[root@redmine redmine-1.3.1]#
1.7.1でも無理(T-T) 残念…。

⇒1.6.2で再々チャレンジ。
[root@redmine ~]# gem update --system 1.6.2
Updating rubygems-update
Fetching: rubygems-update-1.6.2.gem (100%)
Successfully installed rubygems-update-1.6.2
Installing RubyGems 1.6.2
RubyGems 1.6.2 installed

=== 1.6.2 / 2011-03-08

Bug Fixes:

* require of an activated gem could cause activation conflicts.  Fixes
  Bug #29056 by Dave Verwer.
* `gem outdated` now works with up-to-date prerelease gems.


-----------------------------------------------------------------

RubyGems installed the following executables:
        /usr/local/bin/gem

RubyGems system software updated
[root@redmine ~]# gem -v
1.6.2
[root@redmine ~]#

[root@redmine ~]# rake generate_session_store
[root@redmine ~]#
→成功したっ!!

[root@redmine redmine-1.3.1]# rake db:migrate RAILS_ENV=production
==  Setup: migrating =====================================================
-- create_table("attachments", {:force=>true})
   -> 0.0841s
-- create_table("auth_sources", {:force=>true})
(中略)

-- add_index(:changeset_parents, [:parent_id], {:name=>:changeset_parents_parent_ids, :unique=>false})
   -> 0.1499s
==  CreateChangesetParents: migrated (0.3711s) ===========================

[root@redmine redmine-1.3.1]#
→スキーマ作成完了。

0 件のコメント:

コメントを投稿