Feed on
Posts
Comments
Email訂閱

This page is under 電腦 Category

在Windows8上(x64)安裝Redmine 使用Mysql當資料庫是一件蠻困難的事情,原因如下:

  1. windows x64平台
  2. ruby用來連接mysql的 libmysql.dll需要特殊處理。
  3. ruby的x64版本不能太新也不能太舊,不然安裝redmine的相關套件時不能支援

References:

  1. 本次安裝主要參考這篇文章:在Windows 7上安裝Redmine with MySQL。但這篇文章是32位元的版本。
  2. 另外redmine 官方的安裝指引也需參考。

以下是本次安裝redmine的環境、軟體版本與需要的程式

  1. Windows8.1(x64)
  2. MySQL(5.5)(x64)
  3. ImageMagick-6.9.0-2-Q8-x64-dll.exe (Download imageMagick http://www.imagemagick.org/download/binaries/)
  4. Ruby 2.0.0-p598 (x64) (目前只有這個版本才能順利下載nokogiri套件的precompiled dll)
  5. RubyInstaller Development Kit (DevKit) For use with Ruby 2.0 and 2.1 (x64 – 64bits only):
    DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe


步驟:

  1. 安裝 ImageMagick。同參考文件1步驟1
  2. 安裝Ruby。同參考文件1步驟3
  3. 安裝RubyInstaller Development Kit。同參考文件1步驟4
  4. 建立MySQL for Redmine的DB、帳號、密碼,並且把相關的權限設定好。參考redmine 官方的安裝指引步驟2。
  5. 製作特製的libmySQL.dll,放到$Ruby\bin\。否則會導致在rake db:migrate 步驟的segmentation fault。參考這篇文章最後倒數第二篇留言: https://github.com/brianmario/mysql2/issues/372。作法:
    1. 取得特製的 mysql-connector-c
    2. 重新編譯 mysql2: gem install mysql2 -v ‘0.3.17’ –source http://rubygems.org/ –no-rdoc –no-ri — ‘–withmysql-dir=”d:\mysql-connector-c-noinstall-6.0.2-winx64\bin” –with-mysql-lib=”d:\mysql-connector-c-noinstall-6.0.2-winx64\lib” –with-mysql-include=”d:\mysql-connector-c-noinstall-6.0.2-winx64\include”‘
    3. Copy the .dll from d:\mysql-connector-c-noinstall-6.0.2-winx64\lib in the bin directory of ruby
  6. 編輯 $Redmine\Gemfile 這個檔案
    1. 將第一行的 source ‘https://rubygems.org’ 改成 source ‘http://rubygems.org’ (如果你的環境一直無法下載ruby的套件的話)
    2. 將mysql2的相關安裝先移除,如
      when ‘mysql2’gem install bundler
      # gem “mysql2”, “~> 0.3.11”, :platforms => [:mri, :mingw]
      # gem “activerecord-jdbcmysql-adapter”, :platforms => :jruby
    3. 在末尾加上
      gem “thin”
      gem “mysql2”, “0.3.17”
  7. 資料庫組態設定(database.yml),參考redmine 官方的安裝指引步驟3。需注意ruby2.0 需設 adapter: mysql2
  8. redmine 相依性套件安裝,參考參考文件1步驟7 或是 redmine 官方的安裝指引步驟4:
    1. gem install bundler –source http://rubygems.org/
    2. bundle install –without development test
  9. 產生session store secret,參考文件1步驟8 或是 redmine 官方的安裝指引步驟5:
    rake generate_secret_token
  10. 產生Database schema objects,參考文件1步驟8 或是 redmine 官方的安裝指引步驟6:
    rake db:migrate RAILS_ENV=”production”。此處若發生無法連接Mysql的錯誤。請在資料庫組態設定(database.yml)中將localhost改為127.0.0.1
  11. 載入預設資料,參考參考參考文件1步驟8 或 redmine 官方的安裝指引步驟7:
    rake db:migrate RAILS_ENV=”production”
  12. 啟動redmine websever
    thin start -e production -p 3000
  13. 瀏覽器開啟http://127.0.0.1:3000/login,預設帳號是admin,密碼admin

 

留言區