sou's blog

落ち着いた華やかさがあり、上品に明るく陽気なさまを表す。

Windows環境でのRedmine構築手順

ここの記事を参考にさせて頂き、バージョンを指定しながら構築する手順

構築する環境

Ruby

Rails

  • rails2.3.11

Redmine

  • redmine1.2.0

DB

  • sqlite3

RubyGems

Rubyのインストール

ここから1.8.7系をダウンロードし、インストールする。
(途中で、環境変数にパスを通すか、拡張子を紐付けるかといったチェックボックスが出てくるのでどちらもチェックしておく)
コマンドプロンプトで正しくインストールされていることを確認。

$ruby -v
ruby 1.8.7 (2011-02-18 patchlevel 334) [i386-mingw32]

$gem -v
1.5.2

Railsのインストール

$gem install rails -v 2.3.11
Fetching: rake-0.9.2.gem (100%)
Fetching: activesupport-2.3.11.gem (100%)
Fetching: activerecord-2.3.11.gem (100%)
Fetching: rack-1.1.2.gem (100%)
Fetching: actionpack-2.3.11.gem (100%)
Fetching: actionmailer-2.3.11.gem (100%)
Fetching: activeresource-2.3.11.gem (100%)
Fetching: rails-2.3.11.gem (100%)
Successfully installed rake-0.9.2
Successfully installed activesupport-2.3.11
Successfully installed activerecord-2.3.11
Successfully installed rack-1.1.2
Successfully installed actionpack-2.3.11
Successfully installed actionmailer-2.3.11
Successfully installed activeresource-2.3.11
Successfully installed rails-2.3.11
8 gems installed
Installing ri documentation for rake-0.9.2...
Installing ri documentation for activesupport-2.3.11...
Installing ri documentation for activerecord-2.3.11...
Installing ri documentation for rack-1.1.2...
Installing ri documentation for actionpack-2.3.11...
Installing ri documentation for actionmailer-2.3.11...
Installing ri documentation for activeresource-2.3.11...
Installing ri documentation for rails-2.3.11...
Installing RDoc documentation for rake-0.9.2...
Installing RDoc documentation for activesupport-2.3.11...
Installing RDoc documentation for activerecord-2.3.11...
Installing RDoc documentation for rack-1.1.2...
Installing RDoc documentation for actionpack-2.3.11...
Installing RDoc documentation for actionmailer-2.3.11...
Installing RDoc documentation for activeresource-2.3.11...
Installing RDoc documentation for rails-2.3.11...

$rails -v
Rails 2.3.11

rakeのダウングレード

$gem uninstall rake
Remove executables:
        rake

in addition to the gem? [Yn]  y
Removing rake

You have requested to uninstall the gem:
        rake-0.9.2
rails-2.3.11 depends on [rake (>= 0.8.3)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn]  y
Successfully uninstalled rake-0.9.2

$gem install rake -v 0.8.7
Fetching: rake-0.8.7.gem (100%)
Successfully installed rake-0.8.7
1 gem installed
Installing ri documentation for rake-0.8.7...
Installing RDoc documentation for rake-0.8.7...

DevKitのインストール

ここから
DevKit-tdm-32-4.5.2-20110712-1620-sfx.exe をRubyのディレクトリにdevkitとかのディレクトリ作ってそこにでも展開しておく。
環境変数に(例)C:\Ruby\devkit\binのPATHを通しておく。

RedClothのインストール

$gem install RedCloth
Fetching: RedCloth-4.2.7-x86-mingw32.gem (100%)
Successfully installed RedCloth-4.2.7-x86-mingw32
1 gem installed
Installing ri documentation for RedCloth-4.2.7-x86-mingw32...
Installing RDoc documentation for RedCloth-4.2.7-x86-mingw32...

sqlite3-rubyのインストール

$gem install sqlite3-ruby
Fetching: sqlite3-1.3.3-x86-mingw32.gem (100%)

=============================================================================

  You've installed the binary version of sqlite3.
  It was built using SQLite3 version 3.7.3.
  It's recommended to use the exact same version to avoid potential issues.

  At the time of building this gem, the necessary DLL files where available
  in the following download:

  http://www.sqlite.org/sqlitedll-3_7_3.zip

  You can put the sqlite3.dll available in this package in your Ruby bin
  directory, for example C:\Ruby\bin

=============================================================================

Fetching: sqlite3-ruby-1.3.3.gem (100%)

#######################################################

Hello! The sqlite3-ruby gem has changed it's name to just sqlite3.  Rather than
installing `sqlite3-ruby`, you should install `sqlite3`.  Please update your
dependencies accordingly.

Thanks from the Ruby sqlite3 team!

<3 <3 <3 <3

#######################################################

Successfully installed sqlite3-1.3.3-x86-mingw32
Successfully installed sqlite3-ruby-1.3.3
2 gems installed
Installing ri documentation for sqlite3-1.3.3-x86-mingw32...

No definition for libversion

Enclosing class/module 'mSqlite3' for class Statement not known
Installing ri documentation for sqlite3-ruby-1.3.3...
Installing RDoc documentation for sqlite3-1.3.3-x86-mingw32...

No definition for libversion

Enclosing class/module 'mSqlite3' for class Statement not known
Installing RDoc documentation for sqlite3-ruby-1.3.3...

mongrel_serviceのインストール

$gem install mongrel_service
Fetching: gem_plugin-0.2.3.gem (100%)
Fetching: cgi_multipart_eof_fix-2.5.0.gem (100%)
Fetching: mongrel-1.1.5-x86-mingw32.gem (100%)
Fetching: mongrel_service-0.4.0.gem (100%)
Successfully installed gem_plugin-0.2.3
Successfully installed cgi_multipart_eof_fix-2.5.0
Successfully installed mongrel-1.1.5-x86-mingw32
Successfully installed mongrel_service-0.4.0
4 gems installed
Installing ri documentation for gem_plugin-0.2.3...
Installing ri documentation for cgi_multipart_eof_fix-2.5.0...
Installing ri documentation for mongrel-1.1.5-x86-mingw32...
Installing ri documentation for mongrel_service-0.4.0...
Installing RDoc documentation for gem_plugin-0.2.3...
Installing RDoc documentation for cgi_multipart_eof_fix-2.5.0...
Installing RDoc documentation for mongrel-1.1.5-x86-mingw32...
Installing RDoc documentation for mongrel_service-0.4.0...

i18nのインストール

$gem install i18n -v 0.4.2
Fetching: i18n-0.4.2.gem (100%)
Successfully installed i18n-0.4.2
1 gem installed
Installing ri documentation for i18n-0.4.2...
Installing RDoc documentation for i18n-0.4.2...

sqlite3のダウンロードと配置

  1. ここから「sqlite-shell-win32-x86-3070701.zip」と「sqlite-dll-win32-x86-3070701.zip」をダウンロード
  2. 解凍してできた「sqlite3.exe」、「sqlite3.dll」、「sqlite3.def」をC:\Windowsディレクトリ配下(PATHが通っているところ)に配置する。

Redmineのダウンロードと配置と設定

  1. ここから「redmine-1.2.0.zip」をダウンロード
  2. 解凍してできた「redmine-1.2.0」ディレクトリを「redmine」にリネーム
  3. 「C:\redmine\config\database.yml.example」を「database.yml」にリネーム
  4. database.ymlのproductionの以下の項目を修正する
production:
  adapter: sqlite3
  database: db/redmine.db

秘密鍵の生成

$cd C:\redmine
$rake config/initializers/session_store.rb
(in C:/redmine)

DBの移行

$cd C:\redmine
$rake db:migrate RAILS_ENV=production

サービスの登録

$mongrel_rails service::install -N "Redmine" -c C:\Redmine -p 80 -e production
** Copying native mongrel_service executable...
Redmine service created.
  1. サービスの一覧から「Redmine」を選択しプロパティを編集する
    • スタートアップの種類
      • 手動→自動
  2. サービスを開始する

エラーが出る場合の回避方法

adminでログインできない場合
vendor/rails/actionpack/lib/action_controller/request.rb 449行目を以下に修正

session.destroy if session and session.respond_to?(:destroy)

You are being redirected.から進まない
ここを参考にC:\redmine\config\initializers\mongrel.rbを作成

完成

あとは、ここを参考に初期設定して完成。