tanamonの稀に良く書く日記

KEEP CALM AND DRINK BEER

CentOSにRedmineを入れる

前にTracを入れたけど、Redmineのほうが(主に見た目的に)良さそうに思えたので入れてみた。本当はpassengerを入れてApache経由で起動できるところまで構築したんだけど、メモをし忘れてた。その部分はいずれ書くかもしれない。

Railsをインストール

# gem install rails --include-dependencies
Bulk updating Gem source index for: http://gems.rubyforge.org
Building native extensions.  This could take a while...
ERROR:  While executing gem ... (Gem::Installer::ExtensionBuildError)
    ERROR: Failed to build gem native extension.

ruby extconf.rb install rails --include-dependencies
checking for fcgiapp.h... no
checking for fastcgi/fcgiapp.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/bin/ruby
        --with-fcgi-dir
        --without-fcgi-dir
        --with-fcgi-include
        --without-fcgi-include=${fcgi-dir}/include
        --with-fcgi-lib
        --without-fcgi-lib=${fcgi-dir}/lib


Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.7 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.7/ext/fcgi/gem_make.out

なんかエラーが出た。

# gem -v
0.9.4

gemのバージョンが古いからかなぁ。

gemをアップデート

# gem update --system
...
# gem -v
1.3.4

Railsをインストール(再挑戦)

# gem install rails --include-dependencies
...

今度は成功した。

データベース作成

# mysql -u root -p
Enter password:
...
mysql> create database redmine;
...
mysql> grant all on redmine.* to 'redmine'@'%' identified by 'redmine' with grant option;
...
mysql> 

Redmineをインストール

# useradd redmine
# passwd redmine
...
# wget http://rubyforge.org/frs/download.php/56909/redmine-0.8.4.tar.gz
# tar xzvf redmine-0.8.4.tar.gz
# mv redmine-0.8.4 /opt/redmine
# cd /opt/redmine
# chown redmine:redmine -R redmine

Redmineの設定

データベース
# cd config
# cp -p database.yml.example database.yml
# vi database.yml
production:
  adapter: mysql
  database: redmine
  host: localhost
  username: root
  password:
  encoding: utf8

この部分を以下のように変更する。

production:
  adapter: mysql
  database: redmine
  host: localhost
  username: root
  password: root
  encoding: utf8
  socket: /var/lib/mysql/mysql.sock
# 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
...
メール
# cp -p email.yml.example email.yml
# vi email.yml
production:
  delivery_method: :smtp
  smtp_settings:
    address: smtp.example.net
    port: 25
    domain: example.net
    authentication: :login
    user_name: redmine@example.net
    password: redmine

この部分を自分の環境に合わせて設定する。

production:
  delivery_method: :smtp
  smtp_settings:
    address: localhost
    port: 25
    domain: tanamon.jp
    #authentication: :login
    #user_name: redmine@example.net
    #password: redmine

redmineの起動

# ruby script/server -e production

http://localhost:3000/にアクセスして動作確認をする。