十月 18

注意:Redmine官方目前並無支援SQL Server,所以如果使用過程中出現問題的話,就只能自己解決了

因工作上的需求,需要把Redmine安裝在windows上,而且要使用SQL Server來當資料庫,
但Redmine預設只支援MySql與SqLite,所以就有了此篇文章的產生。
幫自己備忘,以後能夠按圖施工,完成Redmine的設置。

請特別注意,SQL Server不要使用2005的任何版本,Redmine執行時會有問題,
為此我花了一些時間去追查,發現有可能是資料型別的問題,
因為SQL Server 2005,不支援date與time這兩種資料型別,
所以請不要使用SQL Server 2005的任何版本來當Redmine的資料庫。

以下是環境的版本與需要的程式
1.Windows 7 with SP1(x86)
2.SQL Server 2008 with SP3(x86) 註:請勿使用SQL Server 2005的任何版本,Redmine會有問題
3.ImageMagick-6.8.0-1-Q8-windows-dll.exe
4.Ruby 1.8.7
5.RubyInstaller Development Kit (DevKit)
6.Redmine 2.x.x
7.TortoiseSVN

施工工程開始:
1.
執行ImageMagick-6.8.0-1-Q8-windows-dll.exe
安裝路徑:C:\ImageMagick-6.8.0-Q16\
安裝時勾選如下圖所示
1

2.
加入環境變數
變數名稱:CPATH
變數值:C:\ImageMagick-6.8.0-Q16\include;
2

加入環境變數
變數名稱:LIBRARY_PATH
變數值:C:\ImageMagick-6.8.0-Q16\lib;
3

3.
安裝Ruby 1.8.7,記得勾選紅框中的2個選項
安裝TortoiseSVN
建立SQL Server 2008 for Redmine的DB、帳號、密碼,並且把相關的權限設定好
4

4.
解壓縮RubyInstaller Development Kit(DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe)
到C:\RubyDevKit\

安裝RubyInstaller Development Kit
開始->執行->cmd
切換資料夾到安裝RubyInstaller Development Kit的位置

CD C:\RubyDevKit
ruby dk.rb init
ruby dk.rb install

5

5.
使用TortoiseSVN下載Redmine,下載到C:\Redmine-MSSQL\
Stable:http://redmine.rubyforge.org/svn/branches/2.1-stable
Development:http://redmine.rubyforge.org/svn/trunk

請自行決定要使用那一個版本
6

6.
編輯 C:\Redmine-MSSQL\Gemfile 這個檔案
於適當的地方加上以下3行後,存檔
gem “thin”
gem “activerecord-sqlserver-adapter”
gem “tiny_tds”
7

下載PatchRedmineDBtoSQLServer.zip解開後有2個檔案,放到C:\Redmine-MSSQL\db\migrate\
蓋過原始的檔案

於C:\Redmine-MSSQL\config\
建立一個名為database.yml的檔案
編輯C:\Redmine-MSSQL\config\database.yml
貼上以下的內容後,存檔(資料庫名稱或帳號密碼如有不同,請自行修改)

production:
adapter: sqlserver
database: redmine
host: localhost
username: redmine
password: “redmine”
encoding: utf8

7.
開始->執行->cmd
切換資料夾到下載Redmine的位置
CD C:\Redmine-MSSQL\

安裝rdoc與bundler,指令如下
gem install rdoc bundler

8

安裝完成後再執行以下指令,即會把redmine所需要的套件下載回來
bundle install
9

8.
開始安裝Redmine
開始->執行->cmd
切換資料夾到下載Redmine的位置
CD C:\Redmine-MSSQL\

執行以下指令用來產生session store secret
rake generate_secret_token
10

執行以下指令建立預設資料庫
rake db:migrate RAILS_ENV=”production”
11

執行以下指令匯入資料庫預設資料,並輸入zh-TW為預設值
rake redmine:load_default_data RAILS_ENV=”production”
12

9.
執行Redmine的Web Server
開始->執行->cmd
切換資料夾到下載Redmine的位置
CD C:\Redmine-MSSQL\

執行以下指令後,Redmine就可以用了
thin start -e production -p 3000
13

打開IE或其他瀏覽器,輸入以下網址
http://127.0.0.1:3000/login

預設的帳號是admin,密碼也是admin

13 Responses to “在Windows 7上安裝Redmine with SQL Server 2008”

  1. 洽吉 Says:

    帥喔

  2. 在Windows 7上安裝Redmine with MySQL | 電腦茶包 Blog Says:

    […] 在Windows 7上安裝Redmine with SQL Server 2008 十一月 […]

  3. Redmine with MySQL installed on Windows 7 | Technical News Says:

    […] in Windows 7 install Redmine with SQL Server 2008 description of how the Redmine execution on SQL Server. the […]

  4. Windows 7 install Redmine with SQL Server 2008 | Technical News Says:

    […] the computer tea bags Blog […]

  5. MoroseDog Says:

    if install have this error:
    You specified: tiny_tds (>= 0) and tiny_tds (~> 0.5.1)

    Resolve:
    install Redmine 2.1.0 is ok.

  6. MoroseDog Says:

    sor,

    Redmine 2.3.0
    and Gemfile: gem “tiny_tds”, “~> 0.5.1”

  7. MoroseDog Says:

    OS: Windows 7 and Windows Server 2003 (ALL ok)

    ImageMagick-6.8.0-1-Q8-windows-dll.exe
    rubyinstaller-1.9.3-p448.exe
    DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe
    redmine-2.3.0
    PatchRedmineDBtoSQLServer.zip
    MSSQL 2008 R2

    —————Gemfile—————

    gem “thin”
    gem “activerecord-sqlserver-adapter”
    gem “tiny_tds”, “~> 0.5.1”

    # gem “mysql2”, “~> 0.3.11”, :platforms => [:mri, :mingw]
    # gem “activerecord-jdbcmysql-adapter”, :platforms => :jruby

    —————database.yml—————
    production:
    adapter: sqlserver
    database: redmine
    host: localhost
    username: sa
    password: “12345”
    encoding: utf8

    ———————————————install msg———————————————
    Microsoft Windows [版本 5.2.3790]
    (C) 版權所有 1985-2003 Microsoft Corp。

    C:\Documents and Settings\Administrator>cd \

    C:\>cd redmine-2.3.0

    C:\redmine-2.3.0>gem install rdoc bundler
    Fetching: rdoc-4.0.1.gem (100%)
    Depending on your version of ruby, you may need to install ruby rdoc/ri data:

    = 1.9.2 : nothing to do! Yay!
    Successfully installed rdoc-4.0.1
    Fetching: bundler-1.3.5.gem (100%)
    Successfully installed bundler-1.3.5
    2 gems installed
    Installing ri documentation for rdoc-4.0.1…
    Installing ri documentation for bundler-1.3.5…
    Installing RDoc documentation for rdoc-4.0.1…
    Installing RDoc documentation for bundler-1.3.5…

    C:\redmine-2.3.0>bundle install
    Fetching gem metadata from https://rubygems.org/………
    Fetching gem metadata from https://rubygems.org/..
    Resolving dependencies…
    Installing rake (10.1.0)
    Installing i18n (0.6.1)
    Installing multi_json (1.8.0)
    Installing activesupport (3.2.13)
    Installing builder (3.0.0)
    Installing activemodel (3.2.13)
    Installing erubis (2.7.0)
    Installing journey (1.0.4)
    Installing rack (1.4.5)
    Installing rack-cache (1.2)
    Installing rack-test (0.6.2)
    Installing hike (1.2.3)
    Installing tilt (1.4.1)
    Installing sprockets (2.2.2)
    Installing actionpack (3.2.13)
    Installing mime-types (1.25)
    Installing polyglot (0.3.3)
    Installing treetop (1.4.15)
    Installing mail (2.5.4)
    Installing actionmailer (3.2.13)
    Installing arel (3.0.2)
    Installing tzinfo (0.3.37)
    Installing activerecord (3.2.13)
    Installing activerecord-sqlserver-adapter (3.2.12)
    Installing activeresource (3.2.13)
    Using bundler (1.3.5)
    Installing mini_portile (0.5.1)
    Installing nokogiri (1.6.0)
    Installing ffi (1.9.0)
    Installing childprocess (0.3.9)
    Installing rubyzip (0.9.9)
    Installing websocket (1.0.7)
    Installing selenium-webdriver (2.35.1)
    Installing xpath (1.0.0)
    Installing capybara (2.0.3)
    Installing coderay (1.0.9)
    Installing daemons (1.1.9)
    Installing eventmachine (1.0.3)
    Installing rack-ssl (1.3.3)
    Installing json (1.8.0)
    Installing rdoc (3.12.2)
    Installing thor (0.18.1)
    Installing railties (3.2.13)
    Installing jquery-rails (2.0.3)
    Installing metaclass (0.0.1)
    Installing mocha (0.13.3)
    Installing net-ldap (0.3.1)
    Installing ruby-openid (2.1.8)
    Installing rack-openid (1.3.1)
    Installing rails (3.2.13)
    Installing rmagick (2.13.2)
    Installing shoulda-context (1.0.2)
    Installing shoulda-matchers (1.4.1)
    Installing shoulda (3.3.2)
    Installing thin (1.5.1)
    Installing tiny_tds (0.5.1)
    Installing yard (0.8.7.2)
    Your bundle is complete!
    Use `bundle show [gemname]` to see where a bundled gem is installed.
    Post-install message from rdoc:
    Depending on your version of ruby, you may need to install ruby rdoc/ri data:

    = 1.9.2 : nothing to do! Yay!

    C:\redmine-2.3.0>

  8. MoroseDog Says:

    Create Service:

    http://www.redmine.org/boards/1/topics/32693

  9. abc Says:

    hi, 請問, 當我執行bundle install後
    它出現
    Gemfile:57:in `block in eval_gemfile’: undefined method `[]’ for nil:NilClass (NoMethodError), 不知這是不是有辦法解決?
    謝謝~

  10. why Says:

    我也出現
    You cannot specify the same gem twice with different version requirements.
    You specified: tiny_tds (>= 0) and tiny_tds (~> 0.5.1)的訊息,
    請問這是要改什麼檔案嗎? thanks

  11. Jason Says:

    to abc:

    因手邊已無redmine + MSSQL的相關環境,暫時無法幫你,請你見諒。

  12. Jason Says:

    to why:

    看文字的說明是指,tiny_tds版本要在 0.5.1 以上。
    你可以確認一下安裝的來源看看。

    或使用redmine + MySQL 比較不會有奇怪的問題。

  13. MoroseDog Says:

    當時我自己製作的安裝手冊中有提到這個。不知道是否可以幫助到你。

    1. 解壓縮redmine-2.3.0
    2. 解壓縮到 C:\redmine-2.3.0
    3. 編輯 C:\ redmine-2.3.0\Gemfile 這個檔案
    4. 於適當的地方加上以下3行後,存檔
    gem “thin”
    gem “activerecord-sqlserver-adapter”
    gem “tiny_tds”, “~> 0.5.1”
    5. 註解掉這兩行
    when ‘mysql2’
    # gem “mysql2”, “~> 0.3.11”, :platforms => [:mri, :mingw]
    # gem “activerecord-jdbcmysql-adapter”, :platforms => :jruby

留下評論

限制時效已用盡。請重新載入驗證碼。