Redmine 安装记录
Requirements
本文用到的系统为64位的 Windows, 使用的数据库为SQL Server 2012。
安装过程中全程翻墙,未使用国内镜像。国内镜像可能会有的包找不到。
- 安装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里的内容是否纸箱ruby安装目录
5. ruby dk.rb install设置完成
### 安装步骤
#### Step 1 Redmine application
下载Readmine 程序:http://www.redmine.org/projects/redmine/wiki/Download。
解压到系统目录,我这里是:E:\www\redmine-3.3.2
#### Step2 创建数据库和用户
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' # 不加这个,后面会没有权限创建表
GO
#### Step 3 - 数据库连接和配置
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
安装过程中出现错误:
**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. 中间出现**错误**:
- 错误描述
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. 中间出现错误:
- 错误描述:
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)
- 错误解决:
数据库配置文件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. 出现错误:
- 错误现象:
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 网路配置**-> **SQLEXPRESS 的协议** -> ** TCP/IP **
参考:https://msdn.microsoft.com/zh-cn/library/ms177440.aspx
4. 出现错误:
- 错误现象:
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 网络配置**中启用**Named Pipes**
- 更改服务器身份验证策略为**SQL Server 和 Windows 身份验证模式**:Micorsoft SQL Server Management Studio => 左边栏的服务器上单击鼠标右键,选择属性=>**安全性**:
![auth_check.png](http://upload-images.jianshu.io/upload_images/1237436-495134e518f0d2e4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
, 重启服务器。
- 参考:https://social.msdn.microsoft.com/Forums/sqlserver/en-US/b9864938-3b9d-46ed-913c-1014d93738d5/microsoft-sql-server-error233?forum=sqldatabaseengine
5. 出现错误:
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. 出现错误:
== 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 - 数据库默认数据集
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 - 文件系统权限
Windows 系统可胜率此步骤。
#### 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 :发现rmagick 问题可以解决,又开始在Win10上尝试Ruby 3.3。