本文参考自官方安装说明,包含安装中遇到问题的解决方案
1. 安装ruby和development kit
- ruby下载地址: https://rubyinstaller.org/downloads/
本文下载的是Ruby 2.3.3 (x64),当前最新版Ruby 2.4.2-2 (x64),该版本安装过程遇到依赖限制(<2.4&&>2.1),因此未使用最新版。
确保目录D:\Ruby23-x64\bin
加入到了环境变量 - ruby development kit 下载地址
本文下载的是DevKit-mingw64-32-4.7.2-20130224-1151-sfx;
2. redmine下载
下载地址:http://www.redmine.org/projects/redmine/wiki/Download
本文下载的是当前最新版redmine-3.4.3.zip
3. 数据库MySQL配置
需要提前安装好数据库,并将
C:\Program Files\MySQL\MySQL Server 5.7\lib\libmysql.dll
复制到ruby/bin
目录下,也可网络下载libmySQL.dll
- 创建数据库
CREATE DATABASE redmine CHARACTER SET utf8mb4;
- 创建数据库的用户,注意修改my_password
如果出现"ERROR 1396 (HY000): Operation CREATE USER failed",执行drop user redmine@localhost;
删除用户
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my_password';
- 给新创建的用户添加权限
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
4. 修改redmine的数据库配置
复制./redmine/config下的database.yml.example为database.yml,注意修改一下字段
production:
adapter: mysql2
database: redmine
host: localhost
username: redmine
password: "my_password"
encoding: utf8
development:
adapter: mysql2
database: redmine_development
host: localhost
username: redmine
password: "my_password"
encoding: utf8
5. 安装gem依赖
Redmine使用Bundler 管理gem依赖
gem install bundler
bundle install --without development test
安装过程可能会有一些安装失败的,需要
运行D:\DevKit-mingw64-64-4.7.2-20130224-1432-sfx\msys.bat
加载mingw64 环境,安装部分依赖,如下图
![](https://img.haomeiwen.com/i7965035/3d4557bc079cc34f.png)
6. 初始化默认配置
- 开始命令生成一个随机的 Key , Rails 用它来加密 cookie ……
bundle exec rake generate_secret_token
- 创建数据库结构,使用下面的命令:
set RAILS_ENV=production
bundle exec rake db:migrate
- 使用下面的命令来向数据库中插入默认的配置数据
set RAILS_ENV=production
bundle exec rake redmine:load_default_data
7. 运行redmine在3000(或其他)端口
修改D:\redmine-3.4.3\config\settings.yml
中
localhost:3000
为192.168.1.250:3000
rails server webrick -e production -p3000
![](https://img.haomeiwen.com/i7965035/66bba646b866e768.png)
外网无法访问时,在
C:\WINDOWS\system32\drivers\etc\hosts
中添加
#add for redmine,192.168.1.250为本机IP
192.168.1.250 localhost
8. 邮件通知服务配置
复制D:\redmine-3.4.3\config
中的文件configuration.yml.example
为configuration.yml
,并添加如下修改
email_delivery:
delivery_method: :smtp
smtp_settings:
address: smtp.exmail.qq.com
port: 465
ssl: true
enable_starttls_auto: true
domain: smtp.exmail.qq.com
authentication: login
user_name: redmine@qqhaha.com
password: redmine@1234
管理端配置如下
![](https://img.haomeiwen.com/i7965035/189d30c7e19cc8b4.png)
注意下面邮件签名,还有个hostname需要替换为本机IP地址
重启服务,添加修改BUG项可以验证
9. 配置开机自动运行
- 最好的方式是最为系统服务启动,可以参考文章,但目前我的环境依赖安装失败
- 可以写一个快捷启动脚本start_redmine.bat,放在
C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
下面,用户登录后能自动启动redmine,脚本内容如下
cd D:\redmine-3.4.3
d:
rails server webrick -e production -p3000
参考文章
http://blog.csdn.net/hasnext/article/details/53129245
http://www.redmine.org/projects/redmine/wiki/RedmineInstall
http://blog.csdn.net/foruok/article/details/40211507
网友评论