• ホーム
  • Redmine
  • Windows10にbitnamiを使わないでRedmineをインストールしてみた

Windows10にbitnamiを使わないでRedmineをインストールしてみた

一般的に、Windowsのローカル環境でRedmineを使おうと思ったらbitnamiのRedmineをインストールすると思いますが、ちょっと思うところがあってbitnamiを使わずにインストールしてみました。

顛末

Rubyのインストール

RedmineはRubyで書かれたソフトウェアですので、Rubyをインストールしないと始まりません。

RubyInstaller からWITH DEVKITのインストーラーをダウンロードします。最新の安定版は2.6ですが、SQLite3の利用の際につまずいたので、2.4にしました。

ダウンロードしたインストーラーを起動してインストールします。インストールオプションは、既定のままにしました。

Redmineのインストール

Redmine をダウンロードします。今回はzip圧縮されたファイルをダウンロードしました。

ダウンロードしたzipファイルをエクスプローラーで適当なフォルダに展開します。(展開先が、Redmineのインストールフォルダになります。)

Redmineの設定

使用するデータベースの設定をします。今回はSQLite3を使います。

ダウンロードしたRedmineのzipファイルを展開したフォルダにconfigというサブフォルダがあり、その中に database.yml.example という名前のファイルがあります。そのファイルをテキストエディタで開いてみると、 SQLite3 configuration example という項目があります。

database.yml という名前の空のファイルを作って、その SQLite3 configuration example の項目をコピーします。先頭の#は外してください。

production:
  adapter: sqlite3
  database: db/redmine.sqlite3

Bundlerをインストールします。依存関係の管理に使用するソフトウェアです。

c:\Ruby24-x64>gem install bundler

Fetching: bundler-2.0.2.gem (100%)
Successfully installed bundler-2.0.2
Parsing documentation for bundler-2.0.2
Installing ri documentation for bundler-2.0.2
Done installing documentation for bundler after 20 seconds
1 gem installed

Redmineを展開したフォルダに移動して、 Gemfile.local という空のファイルを作成します。これは、Redmine自体は使わないけれども実行時にロードする必要があるgemを設定するファイルです。その中に下記のように thin と thin-service を設定します。thinはアプリケーションサーバーです。

gem "thin"
gem "thin_service"

Bundlerを使ってインストールをします。

c:\Ruby24-x64\redmine-4.0.4>bundle install --without development test rmagick

秘密鍵を生成します。

c:\Ruby24-x64\redmine-4.0.4>bundle exec rake generate_secret_token
Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'
rake aborted!
LoadError: cannot load such file -- 2.4/rubyeventmachine

エラー発生。

eventmachineというgemを一度アンインストールして、再インストールしてみます。

c:\Ruby24-x64\redmine-4.0.4>gem uninstall eventmachine

You have requested to uninstall the gem:
        eventmachine-1.2.7-x64-mingw32

thin-1.7.2 depends on eventmachine (>= 1.0.4, ~> 1.0)
websocket-driver-0.7.1 depends on eventmachine (>= 0, development)
If you remove this gem, these dependencies will not be met.
Continue with Uninstall? [yN]  y
Successfully uninstalled eventmachine-1.2.7-x64-mingw32

c:\Ruby24-x64\redmine-4.0.4>gem install eventmachine --platform ruby

Fetching: eventmachine-1.2.7.gem (100%)
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions.  This could take a while...
Successfully installed eventmachine-1.2.7
Parsing documentation for eventmachine-1.2.7
Installing ri documentation for eventmachine-1.2.7
Done installing documentation for eventmachine after 8 seconds
1 gem installed

もう一度、秘密鍵を生成してみます。

c:\Ruby24-x64\redmine-4.0.4>bundle exec rake generate_secret_token

データベースのマイグレーションをします。

c:\Ruby24-x64\redmine-4.0.4>bundle exec rake db:migrate RAILS_ENV="production"

デフォルトのデータを設定します。

c:\Ruby24-x64\redmine-4.0.4>bundle exec rake redmine:load_default_data RAILS_ENV="production" REDMINE_LANG="ja"

Default configuration data loaded.

試しに起動してみます。起動してからブラウザで http:localhost:3000/ にアクセスすると、Redmineにアクセスできます。

c:\Ruby24-x64\redmine-4.0.4>bundle exec  thin start -e production -p 3000 -a 0.0.0.0 -c "C:\Ruby24-x64\redmine-4.0.4"
Using rack adapter
テスト起動

Windowsで継続的に動くようにする

Windowsのサービスとして登録します。

c:\Ruby24-x64\redmine-4.0.4>thin_service install -N "Redmine" -c "C:\Ruby24-x64\redmine-4.0.4" -p 3000 -e production

** Copying native thin_service executable...
Redmine service created.

コルタナで検索するなどしてサービスの設定ウインドウを開いて、登録したサービスを自動起動にして開始します。

サービスの設定

サービスとして開始した後に http:localhost:3000/ にアクセスすると、Redmineにアクセスできます。

公開日

広告