CentOS 5.5 + redmine
CentOS 5.5 x86_64
※まだ作りかけ+未整理
参考サイト
http://www.sakuttoly.com/blog/2009/04/redmine_passenger_centos.html
********************************************************************************
前提?のクリア
(これ以外にもApacheとかMySQLとかはもちろん必要)
[root@sv02 ~]# yum -y install kernel-devel zlib-devel openssl-devel httpd-devel gcc-c++ apr-devel
********************************************************************************
Rubyインストール
最新版(安定版):http://www.ruby-lang.org/ja/
[root@sv02 ~]# wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p299.tar.gz
--2010-07-06 15:58:10-- ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p299.tar.gz
=> `ruby-1.8.7-p299.tar.gz'
ftp.ruby-lang.org をDNSに問いあわせています... 221.186.184.68
ftp.ruby-lang.org|221.186.184.68|:21 に接続しています... 接続しました。
anonymous としてログインしています... ログインしました!
==> SYST ... 完了しました。 ==> PWD ... 完了しました。
==> TYPE I ... 完了しました。 ==> CWD /pub/ruby/1.8 ... 完了しました。
==> SIZE ruby-1.8.7-p299.tar.gz ... 4867600
==> PASV ... 完了しました。 ==> RETR ruby-1.8.7-p299.tar.gz ... 完了しました。
長さ: 4867600 (4.6M)
100%[==============================================================================>] 4,867,600 5.34M/s 時間 0.9s
2010-07-06 15:58:11 (5.34 MB/s) - `ruby-1.8.7-p299.tar.gz' へ保存終了 [4867600]
[root@sv02 ~]# tar zxfv ruby-1.8.7-p299.tar.gz
[root@sv02 ~]# cd ruby-1.8.7-p299
[root@sv02 ruby-1.8.7-p299]# ./configure --prefix=/usr
[root@sv02 ruby-1.8.7-p299]# make && make install
[root@sv02 ~]# ruby -v
ruby 1.8.7 (2010-06-23 patchlevel 299) [x86_64-linux]
********************************************************************************
RubyGemsインストール
最新版:http://rubyforge.org/frs/?group_id=126&release_id=33411
[root@sv02 ~]# wget http://rubyforge.org/frs/download.php/70696/rubygems-1.3.7.tgz
--2010-07-06 16:02:34-- http://rubyforge.org/frs/download.php/70696/rubygems-1.3.7.tgz
rubyforge.org をDNSに問いあわせています... 205.234.109.19
rubyforge.org|205.234.109.19|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 302 Found
場所: http://files.rubyforge.vm.bytemark.co.uk/rubygems/rubygems-1.3.7.tgz [続く]
--2010-07-06 16:02:34-- http://files.rubyforge.vm.bytemark.co.uk/rubygems/rubygems-1.3.7.tgz
files.rubyforge.vm.bytemark.co.uk をDNSに問いあわせています... 80.68.94.54
files.rubyforge.vm.bytemark.co.uk|80.68.94.54|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 290986 (284K) [application/x-gzip]
`rubygems-1.3.7.tgz.1' に保存中
100%[==============================================================================>] 290,986 132K/s 時間 2.1s
2010-07-06 16:02:37 (132 KB/s) - `rubygems-1.3.7.tgz.1' へ保存完了 [290986/290986]
[root@sv02 tmp]# tar zxfv rubygems-1.3.7.tgz
[root@sv02 tmp]# cd rubygems-1.3.7
[root@sv02 rubygems-1.3.7]# ruby setup.rb
[root@sv02 rubygems-1.3.7]# gem -v
1.3.7
********************************************************************************
Ruby on Railsインストール
[root@sv02 rubygems-1.3.7]# gem update --system
Updating RubyGems
Nothing to update
[root@sv02 rubygems-1.3.7]# gem install rails --include-dependencies
INFO: `gem install -y` is now default and will be removed
INFO: use --ignore-dependencies to install only the gems you list
Successfully installed rake-0.8.7
Successfully installed activesupport-2.3.8
Successfully installed activerecord-2.3.8
Successfully installed rack-1.1.0
Successfully installed actionpack-2.3.8
Successfully installed actionmailer-2.3.8
Successfully installed activeresource-2.3.8
Successfully installed rails-2.3.8
8 gems installed
Installing ri documentation for rake-0.8.7...
Installing ri documentation for activesupport-2.3.8...
Installing ri documentation for activerecord-2.3.8...
Installing ri documentation for rack-1.1.0...
Installing ri documentation for actionpack-2.3.8...
Installing ri documentation for actionmailer-2.3.8...
Installing ri documentation for activeresource-2.3.8...
Installing ri documentation for rails-2.3.8...
Installing RDoc documentation for rake-0.8.7...
Installing RDoc documentation for activesupport-2.3.8...
Installing RDoc documentation for activerecord-2.3.8...
Installing RDoc documentation for rack-1.1.0...
Installing RDoc documentation for actionpack-2.3.8...
Installing RDoc documentation for actionmailer-2.3.8...
Installing RDoc documentation for activeresource-2.3.8...
Installing RDoc documentation for rails-2.3.8...
[root@sv02 ~]# gem install rack --version '~> 1.0.1'
Successfully installed rack-1.0.1
1 gem installed
Installing ri documentation for rack-1.0.1...
Installing RDoc documentation for rack-1.0.1...
[root@sv02 ~]# rails -v
Rails 2.3.8
********************************************************************************
redmineインストール
最新版:http://rubyforge.org/frs/?group_id=1850
[root@sv02 ~]# wget http://rubyforge.org/frs/download.php/71421/redmine-0.9.5.tar.gz
--2010-07-06 16:27:47-- http://rubyforge.org/frs/download.php/71421/redmine-0.9.5.tar.gz
rubyforge.org をDNSに問いあわせています... 205.234.109.19
rubyforge.org|205.234.109.19|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 302 Found
場所: http://files.rubyforge.vm.bytemark.co.uk/redmine/redmine-0.9.5.tar.gz [続く]
--2010-07-06 16:27:48-- http://files.rubyforge.vm.bytemark.co.uk/redmine/redmine-0.9.5.tar.gz
files.rubyforge.vm.bytemark.co.uk をDNSに問いあわせています... 80.68.94.54
files.rubyforge.vm.bytemark.co.uk|80.68.94.54|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 4569167 (4.4M) [application/x-gzip]
`redmine-0.9.5.tar.gz.1' に保存中
100%[==============================================================================>] 4,569,167 1.07M/s 時間 4.1s
2010-07-06 16:27:53 (1.07 MB/s) - `redmine-0.9.5.tar.gz.1' へ保存完了 [4569167/4569167]
[root@sv02 ~]# tar zxfv redmine-0.9.5.tar.gz
[root@sv02 ~]# mkdir /var/www/redmine
[root@sv02 ~]# mv redmine-0.9.5/* /var/www/redmine/
[root@sv02 ~]# cd /var/www/redmine/config/
[root@sv02 config]# cp -p database.yml.example database.yml
[root@sv02 config]# vi database.yml
「production:」の内容(MySQLへの接続情報)を適宜設定し、同項目の下部に以下を追加
socket: /var/lib/mysql/mysql.sock
[root@sv02 config]# vi environment.rb
「Rails::Initializer.run do |config|」の下(21行目付近)に下記を追加
但しxxxxxの部分は30文字以上でランダム英数字を設定
config.action_controller.session = { :key => "_myapp_session", :secret => "xxxxx" }
[root@sv02 config]# gem install mysql
Building native extensions. This could take a while...
Successfully installed mysql-2.8.1
1 gem installed
Installing ri documentation for mysql-2.8.1...
(長いので省略)
[root@sv02 config]# rake db:migrate RAILS_ENV="production"
(in /var/www/redmine)
== Setup: migrating ==========================================================
-- create_table("attachments", {:force=>true})
-> 0.0117s
(長いので省略)
[root@sv02 config]# rake load_default_data RAILS_ENV="production"
(in /var/www/redmine)
Select language: bg, bs, ca, cs, da, de, el, en, es, fi, fr, gl, he, hr, hu, id, it, ja, ko, lt, nl, no, pl, pt, pt-BR, ro, ru, sk, sl, sr, sv, th, tr, uk, vi, zh, zh-TW [en] ja
====================================
Default configuration data loaded.
Note: The rake task load_default_data has been deprecated, please use the replacement version redmine:load_default_data
(途中で「ja」を入力してEnterキーを押下)
********************************************************************************
起動テスト
[root@sv02 config]# cd ../
[root@sv02 redmine]# script/server -e production
=> Booting WEBrick
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
./script/../config/../vendor/rails/railties/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2010-07-06 16:55:07] INFO WEBrick 1.3.1
[2010-07-06 16:55:07] INFO ruby 1.8.7 (2010-06-23) [x86_64-linux]
[2010-07-06 16:55:07] INFO WEBrick::HTTPServer#start: pid=28525 port=3000
(Ctrl+Cで終了させる)
********************************************************************************
Passengerインストール
[root@sv02 redmine]# gem install passenger
Building native extensions. This could take a while...
Building native extensions. This could take a while...
Successfully installed fastthread-1.0.7
Successfully installed passenger-2.2.15
2 gems installed
Installing ri documentation for fastthread-1.0.7...
[root@sv02 redmine]# passenger-install-apache2-module
Welcome to the Phusion Passenger Apache 2 module installer, v2.2.15.
This installer will guide you through the entire installation process. It
shouldn't take more than 3 minutes in total.
Here's what you can expect from the installation process:
1. The Apache 2 module will be installed for you.
2. You'll learn how to configure Apache.
3. You'll learn how to deploy a Ruby on Rails application.
Don't worry if anything goes wrong. This installer will advise you on how to
solve any problems.
Press Enter to continue, or Ctrl-C to abort.
(Enterキーを押下)
Checking for required software...
* GNU C++ compiler... found at /usr/bin/g++
* Ruby development headers... found
* OpenSSL support for Ruby... found
* RubyGems... found
* Rake... found at /usr/bin/rake
* rack... found
* Apache 2... found at /usr/sbin/httpd
* Apache 2 development headers... found at /usr/sbin/apxs
* Apache Portable Runtime (APR) development headers... found at /usr/bin/apr-1-config
* Apache Portable Runtime Utility (APU) development headers... found at /usr/bin/apu-1-config
(全部foundであること)
The Apache 2 module was successfully installed.
Please edit your Apache configuration file, and add these lines:
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.15
PassengerRuby /usr/bin/ruby
After you restart Apache, you are ready to deploy any number of Ruby on Rails
applications on Apache, without any further Ruby on Rails-specific
configuration!
Press ENTER to continue.
(Apacheの設定内容を教えてくれるのでメモ & Enterキーを押下)
Deploying a Ruby on Rails application: an example
Suppose you have a Rails application in /somewhere. Add a virtual host to your
Apache configuration file and set its DocumentRoot to /somewhere/public:
ServerName www.yourhost.com
DocumentRoot /somewhere/public # <-- be sure to point to 'public'!
AllowOverride all # <-- relax Apache security settings
Options -MultiViews # <-- MultiViews must be turned off
And that's it! You may also want to check the Users Guide for security and
optimization tips, troubleshooting and other useful information:
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/doc/Users guide Apache.html
Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl)
http://www.modrails.com/
Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.
(VirtualHost用の設定も教えてくれるのでメモ)
[root@sv02 redmine]# vi /etc/httpd/conf.d/passenger.conf
2回メモした内容を記述
ServerNameは適宜書き換え
DocumentRootとDirectoryのパスはredmineをインストールしたパスの配下のpublicを指定
(私の場合だと/var/www/redmine/public)
VirtualHostは他のファイルでもやっていると読み込み順序によって挙動が変わる場合があるので注意
[root@sv02 redmine]# chown -R apache:apache files log tmp config/environment.rb
[root@sv02 redmine]# /etc/init.d/httpd configtest
Syntax OK
[root@sv02 ~]# /etc/init.d/httpd restart
httpd を停止中: [ OK ]
httpd を起動中: [ OK ]
設定したVirtualHostにアクセスし、初期IDとPassword「admin」でログイン出来ることを確認
adminアカウントのパスワード変更+言語変更(English→Japanese)をする
お疲れ様でした。
Tarボールmakeするなら、Pacoが最近オススメす。
ttp://d.hatena.ne.jp/rx7/20081011/p2
RoR環境のアップデートがわりかし早いので、インスコするのがめんどいw
ほっほー、こんなものがあるのか。
ちょっとテスト環境作ってやってみるかな。