標籤:table val net without 建議 帳號 5.5 添加 完整
安裝準備
伺服器作業系統:Windows Server 2008 R2 Standard,64位作業系統。
RailsInstaller版本:2.2.4 (http://railsinstaller.org/en)
ruby-2.0.0-p598-i386-mingw32.7z 檔案( http://rubyinstaller.org/downloads/)
Redmine版本:2.5.3 (http://www.redmine.org/projects/redmine/wiki/Download)
MySQL版本:5.5.54-win32(https://dev.mysql.com/downloads/mysql/5.5.html#downloads)
ImageMagick版本:6.9.0-0-Q16-x86-dll (http://www.imagemagick.org/script/binary-releases.php)
安裝RailsInstaller
安裝過程如下:
單擊“Install”按鈕開始安裝,安裝完成後出現Rails Environment Configuration的命令列環境:
此時,Ruby on rails環境已搭建好。
安裝MySQL
安裝過程如下:
選擇Complete完整安裝,Next繼續。
此時,MySQL資料庫已裝好。
安裝Redmine
1 把redmine zip包解壓到C:\Sites目錄下。
2 為了讓Redmine正常串連MySQL,需要把MySQL下的libmysql.dll拷貝到Ruby的bin目錄下。
3 安裝mysql2。
gem install mysql2
此時如果報錯:checking for ruby/thread.h ...no說明找不到thread.h檔案,解決如下:
下載ruby-2.0.0-p598-i386-mingw32.7z檔案,解壓後把include/ruby-2.0.0/ruby/thread.h檔案拷貝到C:\RailsInstaller\Ruby1.9.3\include\ruby-1.9.1\ruby目錄下。
再次執行gem install mysql2若又報錯:checking for mysql_query() in -lmysqlclient ...no說明找不到mysqlclient庫,解決如下:
ruby-2.0.0-p598-i386-mingw32.7z檔案解壓後,把include和lib整個目錄檔案都拷貝到C:\mysql_sdk目錄。
執行如下命令:
gem install mysql2 -- --with-mysql-dir="C:/mysql_sdk"
4 MySQL建庫、新增使用者並授權。
CREATE DATABASE redmine CHARACTER SET utf8;CREATE USER ‘redmine‘@‘localhost‘ IDENTIFIED BY ‘redmine‘;GRANT ALL PRIVILEGES ON redmine.* TO ‘redmine‘@‘localhost‘;
5 設定資料庫串連。
把 C:\Sites\redmine-2.5.3\config目錄下的 database.yml.example 原地拷貝一份,名字改為 database.yml ,然後用文字編輯器開啟它,資料庫連接就在 database.yml 中配置。
6 安裝Dependencies。
Redmine使用Bundler管理gems依賴,首先安裝Bundler:
gem install bundler
安裝Redmine需要的所有gems依賴:
bundle install --without development test
此時如果ImageMagick沒有安裝,我們使用如下命令可以跳過:
bundle install --without development test rmagick
如果出現Your bundle is complete! 則代表安裝需用到的gems成功。下面說下bundle install失敗的一些情況:
若出現某個gem依賴安裝失敗,如所示
解決辦法如下:先通過錯誤提示的網址單獨下載該gem依賴,然後把檔案放到redmine-2.5.3目錄下,執行如下命令:
gem install -v=10.1.1 rake
安裝成功後,繼續執行 bundle install --without development test命令。
因rubygems.org伺服器不穩定,建議使用Ruby Gems鏡像,詳細請查看:http://gems.ruby-china.org/
7 產生會話儲存體金鑰。
This step generates a random key used by Rails to encode cookies storing session data thus preventing their tampering.
Generating a new secret token invalidates all existing sessions after restart.
bundle exec rake generate_secret_token
8 建立資料庫結構。
set RAILS_ENV=productionbundle exec rake db:migrate
It will create tables by running all migrations one by one then create the set of the permissions and the application administrator account, named admin
.
9 設定資料庫預設資料。
set RAILS_ENV=productionset REDMINE_LANG=zhbundle exec rake redmine:load_default_data
若輸入zh斷行符號報錯:Got a packet bigger than ‘max_allowed_packet‘ bytes...則需修改資料庫配置。
找到MySQL設定檔my.ini,在[mysqld]部分添加一句:max_allowed_packet=16M,也可以修改更大一點。
重啟MySQL服務讓設定檔生效:
net stop mysqlnet start mysql
10 測試安裝。
bundle exec ruby script/rails server webrick -e production
瀏覽器訪問http://localhost:3000/
11 管理員帳號登入。
Use default administrator account to log in:
- login: admin
- password: admin
Windows下安裝Redmine-2.5.3