FreeBSD上でRedmineを試してみる

2ヶ月ほどTracを試してみましたが、1つのサイトで1つのプロジェクトしか基本的に管理できないというところがどうしても使いづらかったです。代わりになるものを探していたところ、Redmineというのが複数プロジェクトを管理できるというそうなので試してみました。

RedmineはJean-Philippe Lang氏によって開発・公開されているオープンソースソフトウェアです。RoRで構築されており、複数のプロジェクトを管理することができるのが特徴です。現在のRedmineのバージョンは4月28日(フランス時間)に公開されたv0.7.0で、GNU GENERAL PUBLIC LICENSE Version 2のもとで公開されています。

実行環境は次のとおりです。

インストールした環境ではRuby関連のアプリケーションを何もインストールしていなかったため、ここではビルドに必要なものからインストールしていきます。(Redmine v0.7.0では、Rails 2.0.2が必須となっているようです)

  1. 必要なアプリケーションをインストール
  2. Redmineのダウンロード
  3. SQLiteでデータベース作成
  4. database.ymlの修正
  5. rake
  6. 動作確認テスト
  7. Apacheの設定

インストールについて

を参考にさせていただきました。ありがとうございます。

必要なアプリケーションをインストール

rake時に必要なアプリケーションを先にportsからインストールしておきます。
  • converters/ruby-iconv
  • databases/rubygems-sqlite3
  • devel/rubygem-rake
  • www/rubygem-rails

Redmineのダウンロード

リポジトリからチェックアウトします。

# svn checkout http://redmine.rubyforge.org/svn/trunk/

SQLiteでデータベース作成

SQLite3でデータベースを作成します。

# sqlite3 redmine
SQLite version 3.5.6
Enter ".help" for instructions
sqlite > .exit

database.ymlの修正

# cp ./trunk/config/database.yml.example database.yml
# vi database.yml

database.yml

production:
  adapter: sqlite3
  dbfile:db/redmine
  timeout: 5000

rake

# rake db:migrate RAILS_ENV="production"
# rake redmine:load_default_data RAILS_ENV="production"

動作確認テスト

# ruby script/server -e production

Webブラウザhttp://localhost:3000/ にアクセスし、動作していたらOKです。

Apacheの設定

Phusion Passengerを使用し、Apache上でRedmineを動作させる設定をします。

# gem install rails --version 2.0.2
# gem install passenger

特に問題がなければ、次のようなメッセージが表示されます。

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-1.0.3/ext/apache2/mod_passenger.so
   RailsSpawnServer /usr/local/lib/ruby/gems/1.8/gems/passenger-1.0.3/bin/passenger-spawn-server
   RailsRuby /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 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
   </VirtualHost>

And that's it! You may also want to check the Users Guide for security and
optimization tips and other useful information:
  /usr/local/lib/ruby/gems/1.8/gems/passenger-1.0.3/doc/Users guide.html

Enjoy Passenger, a product of Phusion (www.phusion.nl) :-)

http://www.modrails.com/

メッセージのとおりにhttpd.confとhttpd-vhosts.confに追記します。ここではVirtualHostのPortを8080に変更しています。

Listen 8080
NameVirtualHost *:8080

<VirtualHost *:8080>
ServerName redmine.sweets.localhost
DocumentRoot "/home/redmine/public"

<Directory />
    Options Indexed FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

</VirtualHost>

日本語の表示環境があらかじめ組まれているため、簡単な設定ですぐに日本語で使ってみることも可能です。Web上からプロジェクトもユーザも作成できるのが嬉しいですね。これからちょっといろいろ試してみたいと思います。