一、预装软件
1.ruby、RubyGems
这两个是一起安装的,直接下载exe安装包安装。
注意:我一开始安装的是2.5版本,但是后来安装过程中有一个软件需要ruby版本小于2.4,然后我又卸载重装的2.3版本。
测试:
ruby -v gem -v |
2.Bundler >= 1.5.0
gem install bundle |
3.mysql
之前装过了。
二、新建数据库
Create an empty utf8 encoded database: “redmine” for example。
CREATE DATABASE redmine CHARACTER SET utf8; CREATE USER 'your username'@'localhost' IDENTIFIED BY 'your_password'; GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost'; |
注意:这里第一句创建了一个数据库redmine,第二句和第三句分别创建了一用户并为该用户配置权限。这里不能创建root用户。
三、数据库配置
Configure the database parameters in config/database.yml。
在redmine的源码中新建config/database.yml(可参考config/database.yml.example),内容为:
production: adapter: mysql2 database: redmine host: localhost username: your username password: "your password" encoding: utf8 |
注意:这里的用户名和密码使用你在上一步中创建的用户名和密码。
四、安装依赖
Install the required gems by running:
bundle install --without development test |
1.安装过程中报错:
解决办法:rubu版本太高,卸载2.5重新安装2.3。
2.继续报错:
ERROR: Error installing redcarpet: The 'redcarpet' native gem requires installed build tools. Please update your PATH to include build tools or download the DevKit from 'http://rubyinstaller.org/downloads' and follow the instructions at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit' |
解决办法:需要构建工具DevKit并添加到path中。去https://rubyinstaller.org/downloads/ 中下载DevKit(页面中下方)安装。继续执行命令发现仍然报错。
执行DevKit安装目录下的devkitvars.bat文件把路径添加到系统变量path中。
继续报错:
Fetching rmagick 2.16.0 Installing rmagick 2.16.0 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: F:/RubyInstallers/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rmagick-2.16.0/ext/RMagick F:/RubyInstallers/Ruby23-x64/bin/ruby.exe -r ./siteconf20180109-35824-1fepgcv.rb extconf.rb *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=F:/RubyInstallers/Ruby23-x64/bin/$(RUBY_BASE_NAME) extconf.rb:141:in ``': No such file or directory - identify -version (Errno::ENOENT) from extconf.rb:141:in `configure_compile_options' from extconf.rb:16:in `initialize' from extconf.rb:548:in `new' from extconf.rb:548:in `<main>' extconf failed, exit code 1 Gem files will remain installed in F:/RubyInstallers/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rmagick-2.16.0 for inspection. Results logged to F:/RubyInstallers/Ruby23-x64/lib/ruby/gems/2.3.0/extensions/x64-mingw32/2.3.0/rm agick-2.16.0/gem_make.out 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. In Gemfile: rmagick |
解决办法:查看安装文件中提示:
If ImageMagick is not installed on your system, you should skip the
installation of the rmagick gem using:
bundle install --without development test rmagick |
安装成功:
五、生成会话秘钥
Generate a session store secret,Under the application main directory run。
进入到redmine的源码主目录下:
bundle exec rake generate_secret_token |
六、创建数据库结构
进入redmine源码主目录下,执行:
bundle exec rake db:migrate RAILS_ENV="production" |
It will create all the tables and an administrator account.
然后去你创建的redmine数据中查看是否新建了表,如果有说明这一步执行成功。
七、启动web
Under the main application directory run:
ruby bin/rails server -e production |
如果看到下面信息说明web启动成功:
=> 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-09 10:59:07] INFO WEBrick 1.3.1 [2018-01-09 10:59:07] INFO ruby 2.3.3 (2016-11-21) [x64-mingw32] [2018-01-09 10:59:07] INFO WEBrick::HTTPServer#start: pid=36248 port=3000 |
然后浏览器打开http://localhost:3000/ 就可以看到redmine主页面了,输入默认用户名密码admin admin就可以登录了。
上文内容不用于商业目的,如涉及知识产权问题,请权利人联系博为峰小编(021-64471599-8017),我们将立即处理。