Redmine 安裝記錄
Requirements
本文用到的系統(tǒng)為64位的 Windows, 使用的數(shù)據(jù)庫為SQL Server 2012莉撇。
安裝過程中全程翻墻,未使用國內(nèi)鏡像。國內(nèi)鏡像可能會有的包找不到。
- 安裝Redmine支持的最高Ruby 版本2.3:rubyinstaller-2.3.3-x64.exe域慷。安裝時勾選:Install Tcl/Tk support 和 Add Ruby executables to your PATH。
- gem 升級:
gem update --system # 可能需要翻墻
gem -v
2.6.11
- 安裝Redmine支持的最高Rails 版本4.2:
gem install rails -v 4.2.5
```
4. 安裝SQL Server 2012: SQLEXPRADV_x64_CHS.exe
5. 安裝DevKit: DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe, 下載地址:http://rubyinstaller.org/downloads/
1. 解壓到某一目錄,如:D:/devkit
2. cd D:/devkit
3. ruby dk.rb init
4. 查看該目錄下的config.yml里的內(nèi)容是否紙箱ruby安裝目錄
5. ruby dk.rb install設(shè)置完成
### 安裝步驟
#### Step 1 Redmine application
下載Readmine 程序:http://www.redmine.org/projects/redmine/wiki/Download犹褒。
解壓到系統(tǒng)目錄抵窒,我這里是:E:\www\redmine-3.3.2
#### Step2 創(chuàng)建數(shù)據(jù)庫和用戶
Redmine database user will be named redmine hereafter but it can be changed to anything else.
** SQL Server**
The database, login and user can be created within SQL Server Management Studio with a few clicks.
If you prefer the command line option with SQLCMD, here's some basic example:
USE [master]
GO
-- Very basic DB creation
CREATE DATABASE [REDMINE]
GO
-- Creation of a login with SQL Server login/password authentication and no password expiration policy
CREATE LOGIN [REDMINE] WITH PASSWORD=N'redminepassword', DEFAULT_DATABASE=[REDMINE], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
GO
-- User creation using previously created login authentication
USE [REDMINE]
GO
CREATE USER [REDMINE] FOR LOGIN [REDMINE]
GO
-- User permissions set via roles
EXEC sp_addrolemember N'db_datareader', N'REDMINE'
GO
EXEC sp_addrolemember N'db_datawriter', N'REDMINE'
GO
EXEC sp_addrolemember N'db_owner', N'REDMINE' # 不加這個,后面會沒有權(quán)限創(chuàng)建表
GO
#### Step 3 - 數(shù)據(jù)庫連接和配置
Copy config/database.yml.example to config/database.yml and edit this file in order to configure your database settings for "production" environment.
Example for a SQL Server database (default host localhost, default port 1433):
production:
adapter: sqlserver
database: redmine
username: redmine # should match the database user name
password: redminepassword # should match the login password
development:
adapter: sqlserver
database: redmine
username: redmine
password: redminepassword
test:
adapter: sqlserver
database: redmine
username: redmine
password: redminepassword
#### Step 4 - 安裝依賴項
Redmine uses Bundler to manage gems dependencies.
You need to install Bundler first:
gem install bundler
Then you can install all the gems required by Redmine using the following command:
bundle install --without development test
安裝過程中出現(xiàn)錯誤:
**An error occurred while installing rmagick (2.16.0), and Bundler cannot
continue.
Make sure that `gem install rmagick -v '2.16.0'` succeeds before bundling.**
**解決辦法**:
安裝ImageMagic 安裝包:“ImageMagick-7.0.5-2-Q16-x64-dll”:
![Uploading imagemagick-setup_789438.gif . . .]
安裝完后叠骑,readmine目錄下打開一個新的命令行李皇。
set CPATH=C:\Program Files\ImageMagick-7.0.5-Q16\include
set LIBRARY_PATH=set LIBRARY_PATH=C:\Program Files\ImageMagick-7.0.5-Q16\lib
參考:http://www.redmine.org/projects/redmine/wiki/HowTo_install_rmagick_gem_on_Windows
#### Step 5 - 生成對話存儲加密
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.
* with Redmine 2.x:
bundle exec rake generate_secret_token
Alternatively, you can store this secret in config/secrets.yml:
http://guides.rubyonrails.org/upgrading_ruby_on_rails.html#config-secrets-yml
#### Step 6 - Database schema objects creation
Create the database structure, by running the following command under the application root directory:
RAILS_ENV=production bundle exec rake db:migrate
Windows syntax:
set RAILS_ENV=production
bundle 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.
1. 中間出現(xiàn)**錯誤**:
- 錯誤描述
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/htmlentities-4.3.1/lib/htmlentities/mappings/expanded.rb:465: warning: key "inodot" is duplicated and overwritten on line 466
rake aborted!
LoadError: cannot load such file -- tiny_tds/tiny_tds
E:/www/redmine-3.3.2/config/application.rb:5:in <top (required)>' E:/www/redmine-3.3.2/Rakefile:5:in
require'
E:/www/redmine-3.3.2/Rakefile:5:in <top (required)>' LoadError: cannot load such file -- tiny_tds/2.3/tiny_tds E:/www/redmine-3.3.2/config/application.rb:5:in
<top (required)>'
E:/www/redmine-3.3.2/Rakefile:5:in require' E:/www/redmine-3.3.2/Rakefile:5:in
<top (required)>'
(See full trace by running task with --trace)
- 錯誤解決:
更改tiny_tds 的版本為最新,更改文件:Gemfile
when /sqlserver/
gem "tiny_tds", "~> 0.6.2", :platforms => [:mri, :mingw, :x64_mingw]
gem "activerecord-sqlserver-adapter", :platforms => [:mri, :mingw, :x64_mingw]
改為
when /sqlserver/
gem "tiny_tds", "~> 1.3.0", :platforms => [:mri, :mingw, :x64_mingw]
gem "activerecord-sqlserver-adapter", :platforms => [:mri, :mingw, :x64_mingw]
2. 中間出現(xiàn)錯誤:
- 錯誤描述:
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/htmlentities-4.3.1/lib/htmlentities/mappings/expanded.rb:465: warning: key "inodot" is duplicated and overwritten on line 466
rake aborted!
ArgumentError: missing :host option if no :dataserver given
E:/www/redmine-3.3.2/app/models/custom_field.rb:37:in <class:CustomField>' E:/www/redmine-3.3.2/app/models/custom_field.rb:18:in
<top (required)>'
E:/www/redmine-3.3.2/lib/redmine/field_format.rb:90:in field_attributes' E:/www/redmine-3.3.2/lib/redmine/field_format.rb:93:in
<class:Base>'
E:/www/redmine-3.3.2/lib/redmine/field_format.rb:50:in <module:FieldFormat>' E:/www/redmine-3.3.2/lib/redmine/field_format.rb:21:in
<module:Redmine>'
E:/www/redmine-3.3.2/lib/redmine/field_format.rb:20:in <top (required)>' E:/www/redmine-3.3.2/lib/redmine.rb:40:in
<top (required)>'
E:/www/redmine-3.3.2/config/initializers/30-redmine.rb:6:in <top (required)>' E:/www/redmine-3.3.2/config/environment.rb:14:in
<top (required)>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
- 錯誤解決:
數(shù)據(jù)庫配置文件config/database.yml 中添加
host: 127.0.0.1
port: 1433
全部的:
production:
adapter: sqlserver
database: redmine
username: redmine
password: redminepassword
host: 127.0.0.1
port: 1433
3. 出現(xiàn)錯誤:
- 錯誤現(xiàn)象:
E:\www\redmine-3.3.2>bundle exec rake db:migrate
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/htmlentities-4.3.1/lib/htmlentities/mappings/expanded.rb:465: warning: key "inodot" is duplicated and overwritten on line 466
rake aborted!
TinyTds::Error: Unable to connect: Adaptive Server is unavailable or does not exist (127.0.0.1:1433)
E:/www/redmine-3.3.2/app/models/custom_field.rb:37:in <class:CustomField>' E:/www/redmine-3.3.2/app/models/custom_field.rb:18:in
<top (required)>'
E:/www/redmine-3.3.2/lib/redmine/field_format.rb:90:in field_attributes' E:/www/redmine-3.3.2/lib/redmine/field_format.rb:93:in
<class:Base>'
E:/www/redmine-3.3.2/lib/redmine/field_format.rb:50:in <module:FieldFormat>' E:/www/redmine-3.3.2/lib/redmine/field_format.rb:21:in
<module:Redmine>'
E:/www/redmine-3.3.2/lib/redmine/field_format.rb:20:in <top (required)>' E:/www/redmine-3.3.2/lib/redmine.rb:40:in
<top (required)>'
E:/www/redmine-3.3.2/config/initializers/30-redmine.rb:6:in <top (required)>' E:/www/redmine-3.3.2/config/environment.rb:14:in
<top (required)>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
- 解決辦法:
在SQL Server 中啟用1433 端口宙枷。**Sql Server Configuration Manager(SQL Server 配置管理器)** -> **SQL Server 網(wǎng)路配置**-> **SQLEXPRESS 的協(xié)議** -> ** TCP/IP **
參考:https://msdn.microsoft.com/zh-cn/library/ms177440.aspx
4. 出現(xiàn)錯誤:
- 錯誤現(xiàn)象:
E:\www\redmine-3.3.2>bundle exec rake db:migrate
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/htmlentities-4.3.1/lib/htmlentities/mappings/expanded.rb:465: warning: key "inodot" is duplicated and overwritten on line 466
rake aborted!
TinyTds::Error: 用戶 'redmine' 登錄失敗疙赠。
E:/www/redmine-3.3.2/app/models/custom_field.rb:37:in <class:CustomField>' E:/www/redmine-3.3.2/app/models/custom_field.rb:18:in
<top (required)>'
E:/www/redmine-3.3.2/lib/redmine/field_format.rb:90:in field_attributes' E:/www/redmine-3.3.2/lib/redmine/field_format.rb:93:in
<class:Base>'
E:/www/redmine-3.3.2/lib/redmine/field_format.rb:50:in <module:FieldFormat>' E:/www/redmine-3.3.2/lib/redmine/field_format.rb:21:in
<module:Redmine>'
E:/www/redmine-3.3.2/lib/redmine/field_format.rb:20:in <top (required)>' E:/www/redmine-3.3.2/lib/redmine.rb:40:in
<top (required)>'
E:/www/redmine-3.3.2/config/initializers/30-redmine.rb:6:in <top (required)>' E:/www/redmine-3.3.2/config/environment.rb:14:in
<top (required)>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
- 解決辦法:
- **SQL Server 配置管理器** 中的**SQL Server 網(wǎng)絡(luò)配置**中啟用**Named Pipes**
- 更改服務(wù)器身份驗證策略為**SQL Server 和 Windows 身份驗證模式**:Micorsoft SQL Server Management Studio => 左邊欄的服務(wù)器上單擊鼠標右鍵,選擇屬性=>**安全性**:
![auth_check.png](http://upload-images.jianshu.io/upload_images/1237436-495134e518f0d2e4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
, 重啟服務(wù)器朦拖。
- 參考:https://social.msdn.microsoft.com/Forums/sqlserver/en-US/b9864938-3b9d-46ed-913c-1014d93738d5/microsoft-sql-server-error233?forum=sqldatabaseengine
5. 出現(xiàn)錯誤:
E:\www\redmine-3.3.2>bundle exec rake db:migrate
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/htmlentities-4.3.1/lib/htmlentities/mappings/expanded.rb:465: warning: key "inodot" is duplicated and overwritten on line 466
rake aborted!
ActiveRecord::StatementInvalid: TinyTds::Error: CREATE TABLE permission denied in database 'REDMINE'.: CREATE TABLE [schema_migrations] ([version] nvarchar(4000) NOT NULL)
TinyTds::Error: CREATE TABLE permission denied in database 'REDMINE'.
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
- 解決辦法:in sql management studio
USE [REDMINE]
GO
EXEC Sp_droprolemember N'db_datareader', N'REDMINE'
GO
EXEC Sp_droprolemember N'db_datawriter', N'REDMINE'
GO
EXEC sp_addrolemember N'db_owner', N'REDMINE'
GO
6. 出現(xiàn)錯誤:
== 20160404080304 ForcePasswordResetDuringSetup: migrating ====================
== 20160404080304 ForcePasswordResetDuringSetup: migrated (0.0055s) ===========
== 20160416072926 RemovePositionDefaults: migrating ===========================
-- change_column("boards", :position, :integer, {:default=>nil})
-> 0.0220s
-- change_column("custom_fields", :position, :integer, {:default=>nil})
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
undefined method type' for nil:NilClass E:/www/redmine-3.3.2/db/migrate/20160416072926_remove_position_defaults.rb:4:in
block in up'
E:/www/redmine-3.3.2/db/migrate/20160416072926_remove_position_defaults.rb:3:in each' E:/www/redmine-3.3.2/db/migrate/20160416072926_remove_position_defaults.rb:3:in
up'
C:in migrate' NoMethodError: undefined method
type' for nil:NilClass
E:/www/redmine-3.3.2/db/migrate/20160416072926_remove_position_defaults.rb:4:in block in up' E:/www/redmine-3.3.2/db/migrate/20160416072926_remove_position_defaults.rb:3:in
each'
E:/www/redmine-3.3.2/db/migrate/20160416072926_remove_position_defaults.rb:3:in up' C:in
migrate'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
- 解決辦法:再次運行出錯命令圃阳。
#### Step 7 - 數(shù)據(jù)庫默認數(shù)據(jù)集
Insert default configuration data in database, by running the following command:
RAILS_ENV=production bundle exec rake redmine:load_default_data
Redmine will prompt you for the data set language that should be loaded; you can also define the REDMINE_LANG environment variable before running the command to a value which will be automatically and silently picked up by the task.
E.g.:
Unices:
RAILS_ENV=production REDMINE_LANG=fr bundle exec rake redmine:load_default_data
Windows:
set RAILS_ENV=production
set REDMINE_LANG=zh
bundle exec rake redmine:load_default_data
#### Step 8 - 文件系統(tǒng)權(quán)限
Windows 系統(tǒng)可勝率此步驟。
#### Step9 - 測試安裝是否成功
Test the installation by running WEBrick web server:
- with Redmine 3.x:
bundle exec rails server webrick -e production
Once WEBrick has started, point your browser to http://localhost:3000/. You should now see the application welcome page.
#### Step 10 - 登錄
Use default administrator account to log in:
- login: admin
- password: admin
You can go to Administration menu and choose Settings to modify most of the application settings.
#### 配置
Redmine settings are defined in a file named *config/configuration.yml.*
If you need to override default application settings, simply copy config/configuration.yml.example to config/configuration.yml and edit the new file; the file is well commented by itself, so you should have a look at it.
These settings may be defined per Rails environment (production/development/test).
Important : don't forget to restart the application after any change.
#### 安裝折騰記錄
* 2017-3-19:Redmine 3.3 怎么裝也裝不上璧帝,試試3.2捍岳, 3.2 需要的Ruby 支持的Ruby 最高版本是2.2。
* 2017-3-19 16:50:23 :發(fā)現(xiàn)rmagick 問題可以解決睬隶,又開始在Win10上嘗試Ruby 3.3锣夹。