FreeBSD7.0にRedmine0.9.3をインストール

以前、CentOS5にRedmineをインストールしたことがあったのですが、FreeBSDにインストールしようとしたら色々つまずいたのでメモ。


以下の記事を参考にさせていただきました。
参考URL:FreeBSD8.1にRedmine1.0.2をインストール


MySQLはインストール済みだったので
redmineユーザとredmineテーブルの追加を行って設定完了


まずは、portsを使ってRedmineのインストール

cd /usr/ports/www/redmine
make install clean


参考記事(Redmine1.0.2)では

Option を聞かれます。こんな感じにしておきました。

[X] MYSQL Enable MySQL support
[ ] POSTGRESQL Enable PostgreSQL support
[X] RMAGIC Enable Gantt charts support
[ ] THIN Use Thin WEB server
[X] PASSENGER Use Apache/Nginx WEB server

とあったのですが、今回は0.9.3であったため

[X] MYSQL Enable MySQL support
[ ] POSTGRESQL Enable PostgreSQL support

しか表示されていませんでした。


そこで、Redmineインストール後にPassengerをインストール

gem install passenger --version 2.2.15
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/local/lib/ruby/gems/1.8/gems/passenger-2.2.15/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.15
PassengerRuby /usr/local/bin/ruby18

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:


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/local/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/

メッセージに従って設定ファイルを作成

Passenger用のapache設定ファイル

vi /usr/local/etc/apache22/Includes/passenger.conf

LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.15/e
xt/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.15
PassengerRuby /usr/local/bin/ruby18


Redmine用のapache設定ファイル

vi /usr/local/etc/apache22/Includes/redmine.conf

Listen *:10000

  DocumentRoot /usr/local/www/redmine/public

  
    AllowOverride all
    Order allow,deny
    Allow from all
    Options -MultiViews
 


Redmine初期設定

  • database.yml.exampleをコピーしてdatabase.ymlを編集
cd /usr/local/www/redmine/config/
cp database.yml.example database.yml
vi database.yml

production:
    adapter: mysql
    database: redmine
    host: localhost
    username: redmineMySQLに登録したユーザ名
    password: password  ← パスワード
    encoding: utf8
  • session storeを作成
cd /usr/local/www/redmine
rake generate_session_store
(in /usr/local/www/redmine)
  • テーブル作成
rake db:migrate RAILS_ENV=production
  • データ投入
rake redmine:load_default_data RAILS_ENV=production
apachectl restart


ブラウザから

http://xxx.xxx.xxx:10000

にアクセスするとRedmineの画面が表示されます。


管理画面の初期設定に関しては、以前のメモ(CentOS5にRedmineをインストール)を参考に設定


これで無事に動きました。
めでたし、めでたし。

                                                                                                                              • -

つまづいた点は、ブラウザからアクセスした際に403エラーが表示されてしまっていたことでした。

apacheのエラーログを見て、/usr/local/etc/apache22/Includes/redmine.confに対して色々修正を行っていたのですが、うまくいかず…


結局、原因はpassengerのインストールの際に最新版を使おうとして、インストールに失敗していたのに気づかず進めてしまっていたためでした…

急いでやろうとして焦ったのがよくなかった…

gem install passenger  ← 最新版がインストールされる
passenger-install-apache2-module

libtool: compile: cannot determine name of library object from `'

Error code 1

Stop in /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/ext/libev.
rake aborted!
Command failed with status (1): [cd ext/libev && make libev.la...]

(See full trace by running task with --trace)

                                                                                      • -

It looks like something went wrong

Please read our Users guide for troubleshooting tips:

/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/doc/Users guide Apache.html

If that doesn't help, please use our support facilities at:

http://www.modrails.com/


We'll do our best to help you.


最終的に、passenger2.2.15(参考サイトに載っていたバージョン)を使うことでうまくインストールできました。


画面表示されるまでにかなり時間がかかってしまったことが反省点。

素早くインストールできるようになりたいけど、こういったことは経験を積むしかないなと思いました。