下載RubyInstaller:http://rubyinstaller.org/downloads/
下載DevKit:https://github.com/downloads/oneclick/rubyinstaller/DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe
下載RubyGems:http://rubygems.org/pages/download
1.1.安裝RubyInstaller
1.2.解壓RubyGems,再使用Ruby命令行工具切換到RubyGems目錄安裝(安裝完之后RubyGems目錄可以刪除):
ruby setup.rb
以后可以用gem update –system來更新RubyGems
在安裝好所有g(shù)em包之后,還可以用gem update來更新所有g(shù)em包
更新了gem包之后,可以用gem cleanup來清除所有包的舊版本(只保留最新版本)
通過gem list可以查看安裝的所有包
1.3.安裝bundler:
gem install bundler
1.4.解壓DevKit,再使用Ruby命令行工具切換到DevKit目錄安裝:
ruby dk.rb initruby dk.rb install
如果覺得以上步驟麻煩的,也可以直接安裝RailsInstaller了事,我為了安裝最新的Ruby版本所以采用以上步驟。
RailsInstaller下載地址:http://railsinstaller.org/
gem install rakegem install rails
在安裝的過程中應(yīng)該會顯示安裝i18n,即語言包,如果沒有提示的話也可以通過以下命令安裝:
gem install i18n
首先,到http://rubyforge.org/projects/rmagick下載rmagick-win32里面的包RMagick-2.12.0-ImageMagick-6.5.6-8-Q8.zip
解壓后安裝ImageMagick-6.5.6-8-Q8-windows-dll.exe,這里我安裝到D:\ImageMagick,注意選中Install…C and C++。
安裝完之后,重新打開一個Ruby命令行工具來安裝rmagick:
gem install rmagick
若是提示失敗則用:
gem install rmagick --platform=ruby -- "--with-opt-include=D:/ImageMagick/include" "--with-opt-lib=D:/ImageMagick/lib"
如果還是失敗就用:
gem install rmagick --platform=ruby -- "--with-opt-dir=D:/ImageMagick"
這樣就安裝上了rmagick 2.1.3(最新版本的Redmine如2.1.5、2.2.0都依賴rmagick 2.1.3而不是2.1.2)
通過http://www.redmine.org/projects/redmine/wiki/Download里的任一種方法下載Redmine
也可以直接從http://rubyforge.org/frs/?group_id=1850下載,我使用的是最新的2.2.0版本
打開Ruby命令行工具,切換到Redmine的目錄來檢查依賴包:
bundle install --without development test
這樣會檢查到未安裝的包,自動下載安裝;without參數(shù)就是用于忽略一些gem包,假如rmagick安裝不成功,那也可以這樣:
bundle install --without development test rmagick
跳過rmagick的安裝;我這里只使用SQLite數(shù)據(jù)庫,所以把另外2個數(shù)據(jù)庫也跳過了:
bundle install --without development test postgresql mysql2
打開Redmine的config目錄,把database.yml.example復(fù)制一份并重命名為database.yml,找到其中的production節(jié)點配置數(shù)據(jù)庫:
production:adapter: sqlite3database: db/redmine_production.sqlite3
這是我使用的SQLite數(shù)據(jù)庫配置。
接下來配置郵件發(fā)送,把configuration.yml.example復(fù)制一份并重命名為configuration.yml,找到default下的email_delivery:
default:# Outgoing emails configuration (see examples above)email_delivery:delivery_method: :smtpsmtp_settings:address: smtp.sina.comport: 25domain: sina.comauthentication: :loginuser_name: "lwme的用戶名@sina.com"password: "lwme的密碼"
以上使用新浪的郵箱作為例子,這個配置好以后,之后進入系統(tǒng)設(shè)置可能還要設(shè)置一下發(fā)送郵件的郵件地址。
打開Ruby命令行工具,切換到Redmine站點根目錄運行:
rake generate_secret_token
打開Ruby命令行工具,切換到Redmine站點根目錄運行:
set RAILS_ENV=productionrake db:migrate
打開Ruby命令行工具,切換到Redmine站點根目錄運行:
set RAILS_ENV=productionset REDMINE_LANG=zhrake redmine:load_default_data
打開Ruby命令行工具,切換到Redmine站點根目錄運行:
ruby script/rails server webrick -e production -p 3000
以上命令使用webrick把Redmine運行在http://localhost:3000,稍等一會就可以通過瀏覽器打開訪問,默認的用戶名密碼都是admin
在局域網(wǎng)中使用過程中,發(fā)現(xiàn)webrick巨慢無比,網(wǎng)上有說用mongrel,但是發(fā)現(xiàn)mongrel已經(jīng)很久沒有更新,所以最終使用了Thin
首先,安裝Thin包:
gem install thin
然后,打開Ruby命令行工具,切換到Redmine站點根目錄運行:
thin start -p 3000 -e production
同樣的也是在3000端口運行
我這里使用的是Windows Server 2003,需要用到工具Windows NT Resource Kit:http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en,下載并安裝它
添加一個名為Redmine的服務(wù):
"C:\Program Files\Windows Resource Kits\Tools\INSTSRV.EXE" Redmine "C:\Program Files\Windows Resource Kits\Tools\SRVANY.EXE"
接著打開注冊表,定位到HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Redmine,然后在Redmine下新建一個項,名為“Parameters”
打開Parameters節(jié)點,在右邊的視圖分別添加3個字符串值:
如果不是用Thin,而是用webrick,那就添加2個字符串值:
然后在系統(tǒng)服務(wù)里把它設(shè)置為自動并啟動它。
對于不是windows server 2003系統(tǒng)的,可以試試thin_service:
gem install thin_service
使用方法通過下面命令來了解:
thin_service install --helpthin_service remove --help
使用方法估計與mongrel_service差不多,mongrel_service是這樣:
mongrel_rails service::install -N D:\ruby\redmine-2.2.0 -p 3000 -e production
thin_service安裝服務(wù)的方法可能會是(未驗證):
thin_service install -N D:\ruby\redmine-2.2.0 -p 3000 -e production
備份老的站點數(shù)據(jù):
下載新的版本,然后在新的站點根目錄下運行命令重新檢查一下依賴包:
bundle install --without development test postgresql mysql2
把以上備份的文件放到新的站點目錄
生成session key:
rake generate_secret_token
升級數(shù)據(jù)庫:
set RAILS_ENV=productionrake db:migrate
清理緩存和會話:
rake tmp:cache:clearrake tmp:sessions:clear
官方安裝指南:http://www.redmine.org/projects/redmine/wiki/RedmineInstall
官方升級指南:http://www.redmine.org/projects/redmine/wiki/RedmineUpgrade
服務(wù)安裝:http://www.redmine.org/boards/2/topics/30741
最后,額外說一下,如果需要創(chuàng)建Git版本庫,需要安裝git包:
gem install git
然后git庫和redmine是同一臺機器的話,就可以在項目設(shè)置里把git目錄設(shè)置為git庫地址如:d:\repo\myproj…