----
[[Redmine:http://redmine.jp/]] をインストールしてみました。
* 環境 [#d445955c]
- FreeBSD 8.1-RELEASE
- ports は 2010/10/09 で最新
ports からさくさくとインストールできます。
DB は MySQL 5.1 を使うことにしました。
Apache と連携する設定も行います。
* Redmine とその依存する port のインストール [#m65b13f9]
www/redmine にあります。1.0.2 です。
#pre{{
fbsd# cd /usr/ports/www/redmine
fbsd# make install clean
}}
Option を聞かれます。こんな感じにしておきました。
#pre{{
[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
}}
依存関係として Ruby 1.8.7 もインストールされます。
これも Option を聞かれましたが、"ONIGURUMA" に追加で
チェックを入れておきました。
#pre{{
[X] ONIGURUMA Build with oniguruma regular expressions lib
[X] RDOC Build and install Rdoc indexes
[ ] DEBUG Compile-in debug info
}}
他にもいろいろとインストールされていきます。
Option が聞かれるものもありますが、そのままで進めました。
かなりたくさんのものがインストールされます。
うちではこのようになりました。
#pre{{
fbsd# pkg_info | wc -l
78
}}
Ruby の環境はこのようになっています。
#pre{{
fbsd# ruby -v
ruby 1.8.7 (2009-12-24 patchlevel 248) [amd64-freebsd8]
}}
Ruby on Rails は Redmine の中に同梱されていたんですね。
/usr/local/www/redmine/vendor/rails の下にありました。
#pre{{
fbsd# ruby /usr/local/www/redmine/vendor/rails/railties/bin/rails -v
Rails 2.3.5
}}
* MySQL のインストール [#t33e1742]
MySQL をインストールします。
#pre{{
fbsd# cd /usr/ports/databases/mysql51-server/
fbsd# make install clean
}}
起動するには /etc/rc.conf に mysql_enable="YES" の行を追記してから、
/usr/local/etc/rc.d/mysql-server を実行します。
#pre{{
fbsd# /usr/local/etc/rc.d/mysql-server start
Starting mysql.
fbsd#
}}
* passenger の設定 [#oa82b682]
Apache と Ruby on Rails を連携させるために、
passenger の設定をします。
/var/db/pkg/rubygem-passenger-2.2.15/+DISPLAY に書いてあるように、
Apache の設定ファイルを書きます。
/usr/local/etc/apache22/Includes/passenger.conf に書きました。
#pre{{
fbsd# cat /usr/local/etc/apache22/Includes/passenger.conf
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
}}
Redmine がインストールされたディレクトリを DocumentRoot にする設定も追加します。
/usr/local/etc/apache22/Includes/redmine.conf としました。
ホスト名やアクセス制限は環境に合わせて変更してください。
#pre{{
fbsd# cat /usr/local/etc/apache22/Includes/redmine.conf
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /usr/local/www/redmine/public
ServerName fbsd
<Directory /usr/local/www/redmine/public>
Allow from 192.168.1.0/24
</Directory>
</VirtualHost>
}}
Apache を起動するには、MySQL と同様に /etc/rc.conf に
apache22_enable="YES" と書いてから起動スクリプトを実行します。
#pre{{
fbsd# /usr/local/etc/rc.d/apache22 start
Performing sanity check on apache22 configuration:
Syntax OK
Starting apache22.
fbsd#
}}
* Redmine の初期設定 [#r997caa8]
ようやく実行環境が整ったということで、
Redmine の初期設定をします。
Redmine の公式サイトにある
[[Installing Redmine:http://www.redmine.org/wiki/redmine/RedmineInstall]] の通りです。
まずは MySQL でデータベースやユーザの作成から。
#pre{{
fbsd# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.51 FreeBSD port: mysql-server-5.1.51_1
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database redmine character set utf8;
Query OK, 1 row affected (0.00 sec)
mysql> create user 'redmine'@'localhost' identified by 'my_password';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on redmine.* to 'redmine'@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
fbsd#
}}
DB の接続情報を設定します。/usr/local/www/redmine/config/database.yml です。
#pre{{
fbsd# cd /usr/local/www/redmine/config/
fbsd# cp database.yml.example database.yml
fbsd# vi database.yml
...
fbsd# cat database.yml
production:
adapter: mysql
database: redmine
host: localhost
username: redmine
password: my_password
encoding: utf8
}}
session store を作ります。
/usr/local/www/redmine ディレクトリで実行します。
#pre{{
fbsd# cd /usr/local/www/redmine
fbsd# rake generate_session_store
(in /usr/local/www/redmine)
fbsd#
}}
テーブル構造などを作ります。
#pre{{
fbsd# rake db:migrate RAILS_ENV=production
...
}}
データを入れます。言語を聞かれるので ja と入れておきます。
#pre{{
fbsd# rake redmine:load_default_data RAILS_ENV=production
(in /usr/local/www/redmine)
Select language: bg, bs, (中略) zh, zh-TW [en] ja
====================================
Default configuration data loaded.
fbsd#
}}
これで設定は終わりです。
* 動作確認 [#ief95a5c]
WWWブラウザからアクセスします。
管理者のユーザは admin/admin です。
&ref(redmine.png,,50%);
あとは頑張って設定していきましょう。
----
- 助かりました。session storeを作るときに、uninitialized constant ActiveSupport::Dependencies::Mutex というメッセージが出たので、/usr/local/www/redmine/Rakefile 内 require 'rake' の前に require 'thread' を追加しました。 -- <たろう> &new{2011-03-16 (水) 06:42:44};
- Ruby や Rails のバージョンが違うとそういうこともあるみたいですね。コメントありがとうございます。 -- すぎむら &new{2011-03-16 (水) 21:30:09};
#comment