Trac を使い始めてからかれこれ4年半。
たまには他のものにも触れてみるかーと、Redmine をインストールしてみたのでメモ。
注意事項
トライアンドエラーの記録なので、不要な手順も含まれています。
あと、「トライアンドエラー」って言うと、「トライアルアンドエラーが正しい!」って言ってくる人がいるけど、それはどうでもいい。
環境
- OSは軽量なもので。
- パッケージもビルド済みのものを利用する。
- というわけで、FreeBSD。
- バージョンはレガシーな 7.4 を選択。
Choose Distributions で minimal を選択してインストール。
Redmine インストール
packages-7-stable で一番新しい、redmine-1.3.1_1 をインストール。
# pkg_add http://ftp.riken.jp/FreeBSD/ports/i386/packages-7-stable/www/redmine-1.3.1_1.tbz
DB 設定
手軽に SQLite で。
# cd /usr/local/www/redmine/config
# cp -p database.yml.example database.yml
# vi database.yml
production:
adapter: sqlite3
database: db/redmine
timeout: 5000
マイグレーション
# rake db:migrate RAILS_ENV="production"
rake: Command not found.
Rake がなかった。
Rake インストール
# pkg_add http://ftp.riken.jp/FreeBSD/ports/i386/packages-7-stable/devel/rubygem-rake-0.9.2.2.tbz
マイグレーション②
# rake db:migrate RAILS_ENV="production"
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /usr/local/www/redmine/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:21.
NOTE: Gem::SourceIndex#initialize is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#initialize called from /usr/local/www/redmine/config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:100.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
Please install RDoc 2.4.2+ to generate documentation.
rake aborted!
A key is required to write a cookie containing the session data. Use config.action_controller.session = { :key => "_myapp_session", :secret => "some secret phrase" } in config/environment.rb
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
A key is required to write a cookie containing the session data. Use config.
セッションストア秘密鍵の生成
# rake config/initializers/session_store.rb
マイグレーション③
# rake db:migrate RAILS_ENV="production"
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /usr/local/www/redmine/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:21.
NOTE: Gem::SourceIndex#initialize is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#initialize called from /usr/local/www/redmine/config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:100.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
Please install RDoc 2.4.2+ to generate documentation.
rake aborted!
no such file to load -- sqlite3
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
no such file to load -- sqlite3
sqlite3 インストール
# pkg_add http://ftp.riken.jp/FreeBSD/ports/i386/packages-7-stable/databases/sqlite3-3.7.9_1.tbz
変化なし。
ruby18-dbd_sqlite3 インストール
# pkg_add http://ftp.riken.jp/FreeBSD/ports/i386/packages-7-stable/ruby/ruby18-dbd_sqlite3-1.2.5.tbz
変化なし。
ruby18-sqlite インストール
# pkg_add http://ftp.riken.jp/FreeBSD/ports/i386/packages-7-stable/databases/ruby18-sqlite-2.2.3.tbz
変化なし。
rubygem-sqlite3 インストール
# pkg_add http://ftp.riken.jp/FreeBSD/ports/i386/packages-7-stable/rubygems/rubygem-sqlite3-1.3.6.tbz
# rake db:migrate RAILS_ENV="production"
マイグレーション成功。
デフォルトデータのロード
# rake load_default_data RAILS_ENV="production"
テスト起動
# ruby script/server -e production
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /usr/local/www/redmine/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:21.
NOTE: Gem::SourceIndex#initialize is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#initialize called from /usr/local/www/redmine/config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:100.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require': no such file to load -- rack/handler/-e (MissingSourceFile)
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from /usr/local/www/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:182:in `require'
from /usr/local/www/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:547:in `new_constants_in'
from /usr/local/www/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:182:in `require'
from /usr/local/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/handler.rb:63:in `try_require'
from /usr/local/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/handler.rb:16:in `get'
from /usr/local/www/redmine/vendor/rails/railties/lib/commands/server.rb:45
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from script/server:3
no such file to load -- rack/handler/-e (MissingSourceFile)
Gem ダウングレード
NOTE が鬱陶しいので消す。
# gem update --system 1.6.2
# ruby script/server -e production
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require': no such file to load -- rack/handler/-e (MissingSourceFile)
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from /usr/local/www/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:182:in `require'
from /usr/local/www/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:547:in `new_constants_in'
from /usr/local/www/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:182:in `require'
from /usr/local/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/handler.rb:63:in `try_require'
from /usr/local/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/handler.rb:16:in `get'
from /usr/local/www/redmine/vendor/rails/railties/lib/commands/server.rb:45
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from script/server:3
テスト起動②
webrick を明示的に指定したら動いた。
# ruby script/server webrick -e production
=> Booting WEBrick
=> Rails 2.3.14 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Apache 設定
Passenger インストール
# pkg_add http://ftp.riken.jp/FreeBSD/ports/i386/packages-7-stable/All/rubygem-passenger-3.0.9_1.tbz
Fetching http://ftp.riken.jp/FreeBSD/ports/i386/packages-7-stable/All/rubygem-passenger-3.0.9_1.tbz... Done.
Fetching http://ftp.riken.jp/FreeBSD/ports/i386/packages-7-stable/All/ca_root_nss-3.12.11_1.tbz... Done.
Fetching http://ftp.riken.jp/FreeBSD/ports/i386/packages-7-stable/All/perl-5.12.4_3.tbz... Done.
pkg_add: package 'perl-5.12.4_3' conflicts with perl-5.14.2_2
pkg_add: please use pkg_delete first to remove conflicting package(s) or -f to force installation
pkg_add: pkg_add of dependency 'perl-5.12.4_3' failed!
Fetching http://ftp.riken.jp/FreeBSD/ports/i386/packages-7-stable/All/curl-7.21.3_2.tbz... Done.
pkg_add: warning: package 'curl-7.21.3_2' requires 'ca_root_nss-3.12.11_2', but 'ca_root_nss-3.12.11_1' is installed
Fetching http://ftp.riken.jp/FreeBSD/ports/i386/packages-7-stable/All/libev-4.04_1,1.tbz... Done.
Fetching http://ftp.riken.jp/FreeBSD/ports/i386/packages-7-stable/All/gdbm-1.9.1.tbz... Done.
Fetching http://ftp.riken.jp/FreeBSD/ports/i386/packages-7-stable/All/db42-4.2.52_5.tbz... Done.
Fetching http://ftp.riken.jp/FreeBSD/ports/i386/packages-7-stable/All/apr-ipv6-devrandom-gdbm-db42-1.4.5.1.3.12_1.tbz... Done.
Fetching http://ftp.riken.jp/FreeBSD/ports/i386/packages-7-stable/All/apache-2.2.21.tbz... Done.
pkg_add: could not find package perl-5.12.4_3 !
pkg_add: pkg_add of dependency 'apache-2.2.21' failed!
package 'perl-5.12.4_3' conflicts with perl-5.14.2_2
Perl ダウングレード、Passenger インストール
# pkg_delete -f perl-5.14.2_2
# pkg_add http://ftp.riken.jp/FreeBSD/ports/i386/packages-7-stable/All/rubygem-passenger-3.0.9_1.tbz
apachectl 動作確認
# apachectl -v
/libexec/ld-elf.so.1: Shared object "libpcre.so.0" not found, required by "httpd"
Shared object "libpcre.so.0" not found, required by "httpd"
# ldd /usr/local/sbin/httpd
/usr/local/sbin/httpd:
libm.so.5 => /lib/libm.so.5 (0x280ce000)
libpcre.so.0 => not found (0x0)
libaprutil-1.so.3 => /usr/local/lib/libaprutil-1.so.3 (0x280e4000)
libdb-4.2.so.2 => /usr/local/lib/libdb-4.2.so.2 (0x28100000)
libgdbm.so.4 => /usr/local/lib/libgdbm.so.4 (0x281d4000)
libexpat.so.6 => /usr/local/lib/libexpat.so.6 (0x281dc000)
libiconv.so.3 => /usr/local/lib/libiconv.so.3 (0x281fc000)
libapr-1.so.4 => /usr/local/lib/libapr-1.so.4 (0x282f4000)
libcrypt.so.4 => /lib/libcrypt.so.4 (0x2831b000)
libthr.so.3 => /lib/libthr.so.3 (0x28334000)
libc.so.7 => /lib/libc.so.7 (0x28349000)
PCRE ダウングレード
libpcre.so.0 のバージョンまで戻す。
# pkg_delete -f pcre-8.31
# pkg_add http://ftp.riken.jp/FreeBSD/ports/i386/packages-7-stable/All/pcre-8.20.tbz
Fetching http://ftp.riken.jp/FreeBSD/ports/i386/packages-7-stable/All/pcre-8.20.tbz... Done.
# apachectl -v
Server version: Apache/2.2.21 (FreeBSD)
Server built: Jan 12 2012 16:35:57
rc.conf 登録
# vi /etc/rc.conf
Accept Filter の警告を消す
# apachectl start
[Mon Sep 17 05:11:47 2012] [warn] (2)No such file or directory: Failed to enable the 'httpready' Accept Filter
# kldload accf_http.ko
# apachectl start
Apache 動作確認
# apachectl start
# apachectl status
lynx: not found
動いてない。
# tail /var/log/httpd-error.log
[Mon Sep 17 04:20:20 2012] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Mon Sep 17 04:20:20 2012] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of "foo.bar"
Configuration Failed
hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of "foo.bar"
hosts 登録
# vi /etc/hosts
Redmine パス追加
# ln -s /usr/local/www/redmine/public/ /usr/local/www/apache22/data/redmine
Passenger 設定
rubygem-passenger インストールの最後に表示される情報を設定。
# vi /usr/local/etc/apache22/httpd.conf
LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.9/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.9
PassengerRuby /usr/local/bin/ruby18
# apachectl restart

ファイル一覧が表示されてしまう。
RailsBaseURI 指定
# vi /usr/local/etc/apache22/httpd.conf
# apachectl restart

ようやく起動。
Redmine 動作確認

ログインしようとしたら Internal error に。
ActiveRecord::StatementInvalid (SQLite3::ReadOnlyException: attempt to write a readonly database: UPDATE "users" SET "last_login_on" = '2012-09-17 05:44:43', "updated_on" = '2012-09-17 05:44:43' WHERE "id" = 1):
DB ファイルを chmod
# cd /usr/local/www/redmine/db/
# ll
total 278
drwxr-xr-x 2 root wheel 9728 Sep 16 01:40 migrate
-rw-r--r-- 1 root wheel 216064 Sep 17 03:21 redmine
-rw-r--r-- 1 root wheel 28241 Sep 17 01:10 schema.rb
# chmod 666 redmine
ディレクトリも chmod。
# cd /usr/local/www/redmine/
# chmod 777 db
今回はあくまで試用が目的なので、暫定処置ってことで。

これでようやく動作するように。
力尽きたので、SCM の設定についてはまた後日。
参考
Redmineのインストール Redmine.JP
http://redmine.jp/guide/RedmineInstall/
アップグレード Redmine.JP
http://redmine.jp/guide/RedmineUpgrade/