2013年10月7日月曜日

FreeBSDでRedmineを使うメモ

まずはパッケージからredmine-2.3.2をインストール
# pkg_add -r redmine
インストール完了
=============================================================================
Redmine was installed.
You now need to setup your Redmine installation so
please have a look at the Installation Guide.
http://www.redmine.org/wiki/redmine/RedmineInstall

If you are upgrading please read the Upgrading Guide
before starting the new version.
http://www.redmine.org/wiki/redmine/RedmineUpgrade
=============================================================================
参考サイトの日本語訳
http://redmine.jp/guide/RedmineInstall/
データベースはPostgreSQL8.4を使用する。
# pkg_add -r postgresql84-server
参考サイト
http://www.kishiro.com/FreeBSD/postgresql8.html
# su pgsql
$ cd /usr/local/pgsql/
$ mkdir data
$ initdb -D ./data --encoding=utf-8 --lc-collate=C
「rc.conf」の設定
postgresql_enable="YES"
postgresql_flags="-w -s -m fast"
postgresql_initdb_flags="--encoding=utf-8 --lc-collate=C"
postgresql_class="default" 
参考サイト(ROLEとは)
http://www.postgresql.jp/document/8.1/html/user-manag.html
データベース作成
$ createdb test_db
SQLコマンドプロンプト入力
$ psql test_db
CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'my_password' NOINHERIT VALID UNTIL 'infinity';
CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;
ユーザ「redmine」作成
# vipw
「config/database.yml」の編集
# cd /usr/local/www/redmine/config
# cp database.yml.example database.yml
production:
adapter: postgresql
database: redmine
host: localhost
username: redmine
password: <postgres_user_password>
encoding: utf8
# schema_search_path: <database_schema> (default - public)
 セッションストア秘密鍵の生成
# rake generate_secret_token
(in /usr/local/www/redmine)
Could not find gem 'pg (>= 0.11.0) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.
エラーになってしまった。
Redmineを実行するために必要なすべてのgemをインストールする。
bundle install --without development test
無事「pg」がインストールされたので先ほどのコマンドを再実行。
# rake generate_secret_token
今度は成功。
データベース上にテーブルを作成
# cd /usr/local/www/redmine
# env RAILS_ENV=production rake db:migrate
デフォルトデータをデータベースに登録
# env RAILS_ENV=production rake redmine:load_default_data
Select languageでは「ja」を選択
パーミッションの設定
# mkdir public/plugin_assets
# chown -R redmine:pgsql files log tmp public/plugin_assets
# chmod -R 755 files log tmp public/plugin_assets
WEBrickによるwebサーバでの起動テスト
# ruby script/rails server webrick -e production
ApacheからRedmineを起動するための設定
参考サイト
http://kanow.jp/freebsd/redmine-install.xhtmlhttp://redmine.jp/tech_note/apache-passenger/
Apacheのインストール
# pkg_add -r apache22
# vi /etc/rc.conf
apache22_enable="YES"
passengerのインストール
# gem install passenger
passengerのApacheモジュールのインストール
# passenger-install-apache2-module
 * Checking for Curl development headers with SSL support...
      Found: no
      Error: Cannot find the `curl-config` command.
curlがないとのコメントが出たのでインストール
# pkg_add -r curl
再度passengerのApacheモジュールのインストール
# passenger-install-apache2-module
以下の設定をhttpd.confに追記
# vi /usr/local/etc/apache22/httpd.conf
LoadModule passenger_module /usr/local/lib/ruby/gems/1.9/gems/passenger-4.0.20/buildout/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.9/gems/passenger-4.0.20
PassengerDefaultRuby /usr/local/bin/ruby19 
RailsBaseURI /redmine
ドキュメントルートディレクトリにredmineのシンボリックリンクを作成
# cd /usr/local/www/apache22/data
# ln -s /usr/local/www/redmine/public redmine
Apacheの起動
# cd /usr/local/etc/rc.d/
# ./apache22 start
Subversionと連携させる
# cd /usr/local/www/redmine/config
# cp configuration.yml.example configuration.yml
# vi configuration.yml
以下のコメントアウトをはずす
scm_subversion_command: svn                                       # (default: svn)
Redmineを再起動するため、Apacheを再起動
# /usr/local/etc/rc.d/apache22 restart
 Redmineの設定画面でsvnが認識されればOK
プロジェクトの「設定」->「リポジトリ」でSubverionのリポジトリ情報を設定する
あとはSubvertionでコミットするときにコメントに以下のキーワードを付与することでチケットとの関連付けが行われる
参照用キーワード:
refs,references,IssueID
修正用キーワード:
fixes,closes
使用例:
refs #33
※これらのキーワードは「管理」->「設定」->「リポジトリ」で確認できる
以下のようにチケットに関連するリビジョンが表示されればOK 

参考サイト
http://redmine.jp/tech_note/subversion/

0 件のコメント:

コメントを投稿