Redmine環境を作る on CentOS 5
主に自分用メモ。Redmineのインストール — Redmine.JPを見れば済む話ではあるけども。
RubyGems
yumレポジトリにはおいてないので、RubyForgeからダウンロードしてインストーる。
http://rubyforge.org/frs/?group_id=126
Passengerインストール
ApacheでRailsアプリを走らせるためのPassenger(mod_rails for Apache)をインストーる。
# gem install passenger
passengerで必要となるパッケージをインストーる。
# yum install httpd-devel apr-devel
続いて、設定。
# passenger-install-apache2-module
Welcome to the Phusion Passenger Apache 2 module installer, v2.2.1. 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を押して続行。必要環境がそろっていれば、自動的にコンパイル処理が実行される。
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.1/ext/apache2/mod_passenger.so PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.1 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を押すと、ご丁寧にVirtualHostの例まで教えてくれる。
Deploying a Ruby on Rails application: an example Suppose you have a Ruby on Rails application in /somewhere. Add a virtual host to your Apache configuration file, and set its DocumentRoot to /somewhere/public, like this: <VirtualHost *:80> ServerName www.yourhost.com DocumentRoot /somewhere/public # <-- be sure to point to 'public'! </VirtualHost> And that's it! You may also want to check the Users Guide for security and optimization tips and other useful information: /usr/lib/ruby/gems/1.8/gems/passenger-2.2.1/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.
自分の例。 /etc/httpd/conf.d/passenger.conf:
# mod_rails
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.1/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.1
PassengerRuby /usr/bin/ruby
<VirtualHost *:80>
ServerName hoge.hoge.
DocumentRoot /var/rails/redmine/public
</VirtualHost>
redmineインストール
RubyForgeからダウンロードしてインストーる。
http://rubyforge.org/frs/?group_id=1850
/var/rails などに展開し、DocumentRootにシンボリックリンクを張る。
$ tar zxf redmine-0.8.3.tar.gz
# ln -s /var/rails/redmine-0.8.3/public /var/www/html/redmine
/var/rails/redmine/database.yml を作成。
# cat - > database.yml production: adapter: sqlite3 dbfile: db/redmine.db timeout: 5000
# rake db:migrate RAILS_ENV=production # rake load_default_data RAILS_ENV=production
Select language: bg, ca, cs, da, de, en, es, fi, fr, he, hu, it, ja, ko, lt, nl, no, pl, pt, pt-br, ro, ru, sk, sr, sv, th, tr, uk, vn, zh, zh-tw [en]
と聞かれるので、"ja"を選択する。
メールの設定。environment.rbから移動した模様。
# cp email.yml.example email.yml
その上で、email.ymlを編集する。
config/environment.rb を編集。
ENV['GEM_HOME'] = '/usr/lib/ruby/gems/1.8' #RAILS_GEM_VERSION = '2.1.2' unless defined? RAILS_GEM_VERSION
設定
virtualhostで指定したホスト名をブラウザで開く。
あとはご自由に。投げっぱなしですが、まぁ見ればわかると思います。