Redmineのインストール
RedmineとはRuby on Railsで作られているプロジェクト管理ツール。
Tracに比べると知名度が低いようだが、Railsが気になるのとデフォルトのテーマがTracよりRedmineの方が見やすいと思ったので、これを使ってみることにする。
CentOS 5.4にRedmine0.9.3をインストールしてみる。
参考サイト
Redmine.JP — Redmine日本語情報サイト
けいの開発記録MySQL/Rubyを用いてMySQLへのデータベースアクセス
http://d.hatena.ne.jp/Mazin/20090809/1249798716 '10.5.31追記
インストール環境
パッケージ | バージョン |
---|---|
Ruby | 1.8.6 |
RubyGems | 1.3.6 |
Ruby on Rails | 2.3.5 |
Redmine | 0.9.3 |
インストール手順
# vi /etc/yum.repos.d/ruby.repo ------------------------------------------------------- [ruby] name=ruby baseurl=http://repo.premiumhelp.eu/ruby/ gpgcheck=0 enabled=0 -------------------------------------------------------
- rubyのインストール
■ruby は1.8.6 が必要なので、1.8.5がインストールされている場合は削除する。(yum listで確認)
# yum remove ruby rdoc ruby-devel ruby-libs.i386
■ruby 1.8.6 をインストール
# yum install ruby rdoc ruby-devel --enablerepo=ruby
- subversion、MySQL、gccのインストール
# yum install subversion # yum install mysql mysql-server mysql-devel # yum install gcc gcc-c++ httpd-devel apr-devel
- rubygemsのインストール
■ディレクトリの作成
# mkdir -p /opt/rubygems # cd /opt/rubygems
■ダウンロード&展開
# wget http://rubyforge.org/frs/download.php/69365/rubygems-1.3.6.tgz # tar xvfz rubygems-1.3.6.tgz # cd rubygems-1.3.6
■インストール
# ruby setup.rb
# gem install -v=2.3.5 rails # gem install mongrel # gem install mysql -- --with-mysql-lib=/usr/lib/mysql
- MYSQLの設定
■サービス起動
# service mysqld start # chkconfig mysqld on
■データベース作成
# mysql ---------------------------------------------------------------------- drop database redmine; create database redmine; grant create,select,insert,delete,update,index,drop,alter on redmine.* to redmine@localhost identified by 'password'; set password for 'redmine'@'localhost' = password('redmine'); flush privileges; ----------------------------------------------------------------------
■文字化け対策
MySQLのデフォルトの文字コードはlatin1らしいので、これをutf8に変更する。
# vi /etc/my.cnf ---------------------------------------------------------------------- [client] default-character-set = utf8 [mysqld] default-character-set = utf8 ----------------------------------------------------------------------
- Redmine0.9.3をインストール
■チェックアウト
# cd /var # svn checkout http://redmine.rubyforge.org/svn/tags/0.9.3/ redmine
- Redmineの設定
■ディレクトリ移動
# cd /var/redmine
■データベース設定
# vi config/database.yml ------------------------------------------------------ production: adapter: mysql database: redmine username: redmine password: redmine host: localhost encoding: utf8 ------------------------------------------------------
■メール発信の設定(Yahoo)
# vi config/email.yml ------------------------------------------------------ production: delivery_method: :async_smtp smtp_settings: address: smtp.mail.yahoo.co.jp port: 587 domain: yahoo.co.jp ------------------------------------------------------
■セッション暗号化用鍵の生成
# rake config/initializers/session_store.rb
■データベースの初期化
# rake db:migrate RAILS_ENV=production # rake redmine:load_default_data RAILS_ENV=production ------------------------------------------------------ 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 ------------------------------------------------------
■動作確認
# script/server -e production
(http://xxx.xxx.xxx.xxx:3000/で確認可能)
Passengerを使ってRedmineをApache上で動かす手順
- passengerのインストール
# gem install passenger
- passengerの設定
# passenger-install-apache2-module
次のようなログが出力されるので控えておく。
-------------------------------------------- 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.11/ext/apache2/mod_passenger.so PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.11 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. -------------------------------------------- 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: <VirtualHost *:80> ServerName www.yourhost.com DocumentRoot /somewhere/public # <-- be sure to point to 'public'! <Directory /somewhere/public> AllowOverride all # <-- relax Apache security settings Options -MultiViews # <-- MultiViews must be turned off </Directory> </VirtualHost> 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.11/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.
- appacheの設定
# vi /etc/httpd/conf/httpd.conf ------------------------------------------------------------------------ LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.11/ext/apache2/mod_passenger.so PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.11 PassengerRuby /usr/bin/ruby <VirtualHost *:80> ServerName redmine.localhost.localdomein DocumentRoot /var/redmine/public <Directory /var/redmine/public> AllowOverride all Options -MultiViews </Directory> </VirtualHost> ------------------------------------------------------------------------
'10.5.31追記(Mazinさんのを参考に)
※ コメント(#)は取り除かないとエラーになる。
このままだとRailsのアプリしか動かないので、次のようにRailsBaseURIでredmineを紐付ける。
# vi /etc/httpd/conf/httpd.conf ------------------------------------------------------------------------ LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.11/ext/apache2/mod_passenger.so PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.11 PassengerRuby /usr/bin/ruby # <VirtualHost *:80> # ServerName redmine.localhost.localdomein # DocumentRoot /var/redmine/public # <Directory /var/redmine/public> # AllowOverride all # Options -MultiViews # </Directory> # </VirtualHost> RailsBaseURI /redmine ------------------------------------------------------------------------
# cd /var/www/html # ln -s /var/redmine/public redmine
# cd /var # chown -R nobody:nobody ./redmine
- appache再起動
# service httpd restart