使用root安装
1、安装RVM,RVM用于安装ruby
yum install rvm (下载完后可需要更改rvm源) sed -i 's!ftp.ruby-lang.org/pub/ruby!ruby.taobao.org/mirrors/ruby!' $rvm_path/config/db
检查版本 rvm -v
2 安装ruby 2.3.0(需要时间,耐心等待)
rvm install 2.3.0
检查版本
3 安装rails(需要时间,会出现似乎没反应的现象,耐心等待即可,可以去喝杯咖啡,或者玩一把lol)
gem install rails
查看版本
rails -v
4下载redmin(下载与ruby版本对应的redmine版本此处使用ruby2.3.0,则使用redmine-3.3.0)
解压: tar zxf redmine-3.3.0.tar.gz
5:依赖组件安装
5.1gem install bundler(等待)
步骤:切换到redmin-3.3.0目录下
5.2
bundle install --without development test rmagick(此处需要耐心处理相关错误,处理方法在下方)
- Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root
- will break this application for all non-root users on this machine.
- Please configure your config/database.yml first
- Fetching gem metadata from https://rubygems.org/.........
- Resolving dependencies...
- Installing rake 10.3.2
- Using i18n 0.6.11
- Using multi_json 1.10.1
- Installing activesupport 3.2.19
- Installing builder 3.0.4
- Installing activemodel 3.2.19
- Using erubis 2.7.0
- Installing journey 1.0.4
- Installing rack 1.4.5
- Installing rack-cache 1.2
- Using rack-test 0.6.2
- Using hike 1.2.3
- Using tilt 1.4.1
- Installing sprockets 2.2.3
- Installing actionpack 3.2.19
- Installing mime-types 1.25.1
- Installing polyglot 0.3.5
- Installing treetop 1.4.15
- Installing mail 2.5.4
- Installing actionmailer 3.2.19
- Installing arel 3.0.3
- Installing tzinfo 0.3.42
- Installing activerecord 3.2.19
- Installing activeresource 3.2.19
- Using bundler 1.7.6
- Installing coderay 1.1.0
- Installing rack-ssl 1.3.4
- Installing json 1.8.1
- Installing rdoc 3.12.2
- Using thor 0.19.1
- Installing railties 3.2.19
- Installing jquery-rails 3.1.2
- Installing net-ldap 0.3.1
- Installing ruby-openid 2.3.0
- Installing rack-openid 1.4.2
- Installing rails 3.2.19
- Installing rbpdf 1.18.2
- Installing redcarpet 2.3.0
- Installing request_store 1.0.5
................
注意:此处会出现类似于以下错误
;
每次按照提示gem install **后再次执行5.2步骤
6 安装连接mysql的gem
gem install mysql2
- Fetching: mysql2-0.3.17.gem (100%)
- Building native extensions. This could take a while...
- Successfully installed mysql2-0.3.17
- Parsing documentation for mysql2-0.3.17
- unable to convert "\xA4" from ASCII-8BIT to UTF-8 for /usr/local/rvm/gems/ruby-2.0.0-p598/extensions/x86-linux/2.0.0/mysql2-0.3.17/mysql2/mysql2.so, skipping
- unable to convert "\xA4" from ASCII-8BIT to UTF-8 for lib/mysql2/mysql2.so, skipping
- Installing ri documentation for mysql2-0.3.17
- 1 gem installed
7 创建名称为redmine的数据库(省略)
8 配置redmine连接数据库
复制
config/database.yml.example
到
config/database.yml
8.1使用vi编辑器编辑database.yml
修改下面相应部分
9 创建一个session安装密匙
rake generate_secret_token
10 创建初始化所有redmine用到的表
RAILS_ENV=production rake db:migrate
执行以上语句会出现以下结果,耐心等待
- == Setup: migrating ==========================================================
- -- create_table("attachments", {:force=>true})
- -> 0.0143s
- -- create_table("auth_sources", {:force=>true})
- -> 0.0099s
- -- create_table("custom_fields", {:force=>true})
- -> 0.0105s
- -- create_table("custom_fields_projects", {:id=>false, :force=>true})
- -> 0.0094s
- -- create_table("custom_fields_trackers", {:id=>false, :force=>true})
- -> 0.0092s
- -- create_table("custom_values", {:force=>true})
- -> 0.0101s
- -- create_table("documents", {:force=>true})
- -> 0.0097s
- -- add_index("documents", ["project_id"], {:name=>"documents_project_id"})
- -> 0.0462s
- -- create_table("enumerations", {:force=>true})
- -> 0.0103s
- -- create_table("issue_categories", {:force=>true})
- -> 0.0101s
- -- add_index("issue_categories", ["project_id"], {:name=>"issue_categories_project_id"})
- -> 0.2005s
- -- create_table("issue_histories", {:force=>true})
- -> 0.1294s
- -- add_index("issue_histories", ["issue_id"], {:name=>"issue_histories_issue_id"})
- -> 0.0326s
- -- create_table("issue_statuses", {:force=>true})
- -> 0.0691s
- -- create_table("issues", {:force=>true})
- -> 0.0152s
- -- add_index("issues", ["project_id"], {:name=>"issues_project_id"})
- -> 0.0333s
- -- create_table("members", {:force=>true})
- -> 0.0119s
- -- create_table("news", {:force=>true})
- -> 0.0108s
- -- add_index("news", ["project_id"], {:name=>"news_project_id"})
- -> 0.0299s
- -- create_table("permissions", {:force=>true})
- -> 0.0749s
- -- create_table("permissions_roles", {:id=>false, :force=>true})
- -> 0.0564s
- -- add_index("permissions_roles", ["role_id"], {:name=>"permissions_roles_role_id"})
- -> 0.0915s
- -- create_table("projects", {:force=>true})
- -> 0.0662s
- -- create_table("roles", {:force=>true})
- -> 0.0671s
- -- create_table("tokens", {:force=>true})
- -> 0.0664s
- -- create_table("trackers", {:force=>true})
.....................省略
11 装入默认的配置信息,输入zh(选择中文)
RAILS_ENV=production rake redmine:load_default_data
出现以下结果 输入zh
- Select language: ar, az, bg, bs, ca, cs, da, de, el, en, en-GB, es, 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.
到了此处已经成功了百分之九十
12 启动redmine
rails server -b0.0.0.0 -p3000 webrick -e production
若想后台执行则使用 rails server -b0.0.0.0 -p3000 webrick -e production -d
其中
-b0.0.0.0指定所有ip都可以访问
-p3000
为指定端口号 ,否则将只能使用默认的ip访问 查看默认ip 使用rails s --help命令查询
也可以直接执行
rails server webrick -e production -d使用默认的ip和端口号来访问redmine
13 开机自动启动
编辑启动文件
vi /etc/rc.local
最后一行或者适当的位置,加入一下内容。此处必须用绝对路径。注意根据实际redmine路径来填写