Redmine 安装记录

Redmine 安装记录

Requirements

本文用到的系统为64位的 Windows, 使用的数据库为SQL Server 2012。
安装过程中全程翻墙,未使用国内镜像。国内镜像可能会有的包找不到。

  1. 安装Redmine支持的最高Ruby 版本2.3:rubyinstaller-2.3.3-x64.exe。安装时勾选:Install Tcl/Tk supportAdd Ruby executables to your PATH
  2. gem 升级:
    gem update --system # 可能需要翻墙
    gem -v
    2.6.11
  1. 安装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:inrequire'
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:inblock 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:inup'
C:in migrate' NoMethodError: undefined methodtype' 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:ineach'
E:/www/redmine-3.3.2/db/migrate/20160416072926_remove_position_defaults.rb:3:in up' C:inmigrate'
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。
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 203,456评论 5 477
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 85,370评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 150,337评论 0 337
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,583评论 1 273
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,596评论 5 365
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,572评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,936评论 3 395
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,595评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,850评论 1 297
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,601评论 2 321
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,685评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,371评论 4 318
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,951评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,934评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,167评论 1 259
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 43,636评论 2 349
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,411评论 2 342

推荐阅读更多精彩内容