步骤一:环境软件准备
*railsinstaller-3.4.0.exe #下载地址:http://railsinstaller.org/en
*redmine-3.4.4.zip #下载地址:http://www.redmine.org/projects/redmine/wiki/Download/
*mysql-5.7.20-winx64.zip #下载地址:https://dev.mysql.com/downloads/mysql/
步骤二:安装railsinstaller,设置redmine
直接运行可执行文件,根据提示完成自定义选择,然后下一步直到结束。最后自动在C盘创建Sites目录。将redmine-3.4.4.zip 文件解压到C:/Sites中。
步骤三:安装MySQL数据库- 解压缩mysql-5.7.20-winx64.zip文件到指定目录中
- 将其目录中的bin路径添加到系统环境变量中:PATH
- 安装Mysql服务
- 在mysql目录下编写my.ini文件
- 使用管理员身份启动cmd.exe
- 执行:mysqld install,net start mysql
- 如果无法启动则执行:mysqld --initialize-insecure --user=mysql,然后再次启动:net start mysql
- 登录测试:mysql -u root -p
步骤五:创建Redmine数据库和用户
- create database redmine character set utf8;
- create user 'redmine'@'localhost' identified by 'your_password';
- grant all privileges on redmine.* to 'redmine'@'localhost';
将C:\Sites\redmine\config下的database.yml.example文件复制一份,并命名为database.yml,然后进行编辑,主要目的是配置数据库的信息。由于bundler的时候忽略了development和test版本,所以只关注“production”部分就好了,修改如下:
# Default setup is given for MySQL with ruby1.9.
# Examples for PostgreSQL, SQLite3 and SQL Server can be found at the end.
# Line indentation must be 2 spaces (no tabs).
production:
adapter: mysql2
database: redmine
host: localhost
username: redmine
password: "your_password"
encoding: utf8
步骤七:安装gem资源文件
打开cmd,进入C:/Sites/redmine-3.4.4目录,使用 gem list 指令查看已经安装的文件。C:\Sites\redmine-3.4.4>gem list
*** LOCAL GEMS ***
actioncable (5.1.3)
actionmailer (5.1.3, 4.2.8)
actionpack (5.1.3, 4.2.8)
actionpack-xml_parser (2.0.1, 1.0.2)
actionview (5.1.3, 4.2.8)
activejob (5.1.3, 4.2.8)
在安装文件之前首先,更改下载地址: gem sources -l 指令查看当前的下载地址是否为:http://gems.ruby-china.org/
如果不是这个下载地址,先移除原来的地址执行:gem sources -a http://gems.ruby-china.org/常用指令:
- 显示当前使用的sources:gem sources
- 添加一个source:gem sources -a url地址
- 删除一个source:gem sources -r url地址
- 更新source cache: gem sources -u
然后执行:bundle install --without development test rmagick 安装所有需要的gems,安装过程中如果提示出错,根据提示内容安装所需要的gem模块:gem install XXX -v=XXXX,一直到安装完成。
步骤八:用命令生成一个随机的 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
提示语言选择:
C:\Sites\redmine-3.4.4>bundle exec rake redmine:load_default_data
Select language: ar, az, bg, bs, ca, cs, da, de, el, en, en-GB, es, es-PA, et, eu, fa, fi, fr, gl, he, hr, hu, id, it, ja, ko, lt, lv, mk, mn, nl, no, pl, pt, pt-BR, ro, ru, sk, sl, sq, sr, sr-YU, sv, th, tr, uk, vi, zh, zh-TW [en] zh
====================================
Default configuration data loaded.
启动Redmine执行下面的命令:
C:\Sites\redmine-3.4.4>rails server webrick -e production
=> Booting WEBrick
=> Rails 4.2.8 application starting in production on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2018-01-11 16:16:27] INFO WEBrick 1.3.1
[2018-01-11 16:16:27] INFO ruby 2.3.3 (2016-11-21) [i386-mingw32]
[2018-01-11 16:16:27] INFO WEBrick::HTTPServer#start: pid=18976 port=3000