LFSトップ | Japanese Only2010/01/26

RedMine-0.9.0

はじめに

参考リンク

ホームページ: http://www.redmine.org/(RedMine自体によりページ構築されている)
日本語情報ページ: http://redmine.jp/
ソース(安定版): http://rubyforge.org/frs/download.php/68515/redmine-0.9.0.tar.gz

依存環境、パッケージ

LFS: バージョン SVN-20100109
MySQL: BLFSブック本サイトメモ   バージョン 5.1.42
Apache: BLFSブック本サイトメモ   バージョン 2.2.14
FastCGI: 本サイトメモ   バージョン 2.4.0
mod_fastcgi: 本サイトメモ   バージョン 2.4.6(Apache用モジュール)
Rails: 本サイトメモ   バージョン 2.3.5
Mongrel_cluster: 本サイトメモ   バージョン 1.0.5

依存パッケージ類の導入

railsユーザーの新規作成

[rootユーザー]
useradd -m -s /bin/bash -g apache rails
passwd rails
rails のパスワードを変更しています
新しいパスワードを入れてください (最短 5 文字)
大文字・小文字・数字を混ぜて使うようにしてください。
新しいパスワード: XXXXX
不正なパスワードです: 単純すぎます
警告: 弱いパスワードです (どうしてもこれを使いたければもう一度入力)。
新しいパスワード: XXXXX
新規パスワード再入力: XXXXX
passwd: password changed.

ソース配置

[railsユーザー]
mkdir ~/sites
cd ~/sites
tar xf <downloadpath>/redmine-0.9.0.tar.gz
[railsユーザー]
cd ~/sites
ln -sv redmine-0.9.0 redmine
`redmine' -> `redmine-0.9.0'

RedMine のDB構築

[railsユーザー]
mysql -u root -p
Enter password: XXXXX
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.42-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
mysql> create database redmine character set utf8;
Query OK, 1 row affected (0.00 sec)

mysql> create user 'redmine'@'localhost' identified by 'redmine';
Query OK, 0 rows affected (0.05 sec)

mysql> grant all privileges on redmine.* to 'redmine'@'localhost';
Query OK, 0 rows affected (0.05 sec)

mysql> \q
Bye

RedMine のDB設定

[railsユーザー]
cd ~/sites/redmine
cp config/database.yml.example config/database.yml
[railsユーザー]
vi config/database.yml
	...
	production:
	  adapter: mysql
	  database: redmine
	  host: localhost
	  username: redmine
	  password: redmine
	  encoding: utf8

	development:
	  adapter: mysql
	  database: redmine_development
	  host: localhost
	  username: redmine
	  password: redmine
	  encoding: utf8

	test:
	  adapter: mysql
	  database: redmine_test
	  host: localhost
	  username: redmine
	  password: redmine
	  encoding: utf8
	...
[railsユーザー]
cd ~/sites/redmine
vi config/environment.rb
  ...
  # Enable page/fragment caching by setting a file-based store
  # (remember to create the caching directory and make it readable to the application)
  # config.action_controller.fragment_cache_store = :file_store, "#{RAILS_ROOT}/cache"

  config.action_controller.session = 
    { :key => "_myapp_session", :secret => "This is test key for RedMine site" }
	...

RedMine のDB定義投入

[railsユーザー]
cd ~/sites/redmine
rake db:migrate RAILS_ENV=production
==  Setup: migrating ==========================================================
-- create_table("attachments", {:force=>true})
   -> 0.0420s
-- create_table("auth_sources", {:force=>true})
   -> 0.0626s
-- create_table("custom_fields", {:force=>true})
   -> 0.0226s
-- create_table("custom_fields_projects", {:force=>true, :id=>false})
   -> 0.0257s
...

==  ChangeWikiContentsTextLimit: migrating ====================================
-- change_column(:wiki_contents, :text, :text, {:limit=>16777216})
   -> 0.0957s
-- change_column(:wiki_content_versions, :data, :binary, {:limit=>16777216})
   -> 0.0764s
==  ChangeWikiContentsTextLimit: migrated (0.1732s) ===========================
[railsユーザー]
rake load_default_data RAILS_ENV=production
(in /home/rails/sites/redmine-0.9.0)

Select language: bg, bs, ca, cs, da, de, el, en, es, fi, fr, gl, he, hu, id, it, ja, ko, l
t, nl, no, pl, pt, pt-BR, ro, ru, sk, sl, sr, sv, th, tr, uk, vi, zh, zh-TW [en] ja
====================================
Default configuration data loaded.

Note: The rake task load_default_data has been deprecated, please use the replacement vers
ion redmine:load_default_data

Mongrel Cluster の設定

[railsユーザー]
cd ~/sites/redmine
mongrel_rails cluster::configure \
 -e production \
 -p 4000 \
 -a 0.0.0.0 \
 -l /home/rails/sites/redmine/log/mongrel_cluster.log \
 -P /var/run/mongrel_cluster/redmine.pid \
 -c /home/rails/sites/redmine \
 -r /home/rails/sites/redmine/public \
 -N 3 \
 --user rails \
 --group apache
Writing configuration file to config/mongrel_cluster.yml.
[rootユーザー]
cd /etc/mongrel_cluster
ln -s /home/rails/sites/redmine/config/mongrel_cluster.yml redmine.yml
[rootユーザー]
/etc/rc.d/init.d/mongrel-cluster restart
Restarting all mongrel_clusters...                                               [  OK  ]
[rootユーザー]
ps -ef | grep mongrel
rails    30398     1 31 20:46 ?        00:00:02 /usr/bin/ruby /usr/bin/mongrel_rails start
 -d -e production -a 0.0.0.0 -c /home/rails/sites/redmine -r /home/rails/sites/redmine/pub
lic --user rails --group apache -p 4000 -P /var/run/mongrel_cluster/redmine.4000.pid -l /h
ome/rails/sites/redmine/log/mongrel_cluster.4000.log
rails    30401     1 27 20:46 ?        00:00:01 /usr/bin/ruby /usr/bin/mongrel_rails start
 -d -e production -a 0.0.0.0 -c /home/rails/sites/redmine -r /home/rails/sites/redmine/pub
lic --user rails --group apache -p 4001 -P /var/run/mongrel_cluster/redmine.4001.pid -l /h
ome/rails/sites/redmine/log/mongrel_cluster.4001.log
rails    30404     1 28 20:47 ?        00:00:01 /usr/bin/ruby /usr/bin/mongrel_rails start
 -d -e production -a 0.0.0.0 -c /home/rails/sites/redmine -r /home/rails/sites/redmine/pub
lic --user rails --group apache -p 4002 -P /var/run/mongrel_cluster/redmine.4002.pid -l /h
ome/rails/sites/redmine/log/mongrel_cluster.4002.log
root     30410 14987  0 20:47 pts/3    00:00:00 grep mongrel

Apache のプロキシ設定

[rootユーザー]
cd /etc/apache/extra
cat > httpd-proxy.conf << "EOF"
ProxyRequests Off
<Proxy *>
  Order deny,allow
  Allow from all
</Proxy>
ProxyPass /redmine/images/ !
ProxyPass /redmine/javascripts/ !
ProxyPass /redmine/stylesheets/ !
ProxyPass /redmine balancer://redmine lbmethod=byrequests timeout=1
ProxyPassReverse /redmine balancer://redmine
<Proxy balancer://redmine>
BalancerMember http://localhost:4000 loadfactor=10
BalancerMember http://localhost:4001 loadfactor=10
BalancerMember http://localhost:4002 loadfactor=10
</Proxy>
EOF
[rootユーザー]
vi /etc/apache/httpd.conf
	...
	Include /etc/apache/extra/httpd-proxy.conf
	...
[rootユーザー]
cd /srv/www/htdocs
mkdir -pv redmine
cd redmine
ln -sv /home/rails/sites/redmine/public/{images,javascripts,stylesheets} .
`./images' -> `/home/rails/sites/redmine/public/images'
`./javascripts' -> `/home/rails/sites/redmine/public/javascripts'
`./stylesheets' -> `/home/rails/sites/redmine/public/stylesheets'
[rootユーザー]
/etc/rc.d/init.d/apache restart
Restarting Apache daemon...                                                      [  OK  ]

RedMine のルート設定

[railsユーザー]
cd ~/sites/redmine
vi config/environment.rb
	...
	config.action_controller.relative_url_root = '/redmine'
	...

RedMine 操作



松 山 道 夫 Michio Matsuyama
michio *underscore* matsuyama *atmark* yahoo *period* co *period* jp