1.说明
redmine和ruby以及rails的版本号关系如下:
Redmine版本 支持Ruby版本 使用Rails版本
4.0 (即将到来的) ruby 2.2,2.3,2.4 Rails 5.1
3.4 ruby 1.9.3,2.0.0,2.1,2.2,2.3,2.4 Rails 4.2
3.3 ruby 1.9.3,2.0.0,2.1,2.2,2.3 Rails 4.2
3.2 ruby 1.9.3.2.0.0,2.1,2.2 Rails 4.2
支持Ruby 1.9.3,2.0和2.1通过Ruby社区已经结束。
Redmine 3.2或更低的不支持Ruby 2.3 。 Redmine 3.3支持Ruby 2.3。
Redmine不支持JRuby 因为一些gems不支持Rails 4.2。
官方安装文档:http://www.redmine.org/projects/redmine/wiki/RedmineInstall
2.安装mysql
参考二进制安装步骤
https://my.oschina.net/ch66880/blog/1523023
关闭访火墙
参考:https://my.oschina.net/ch66880/blog/1522782
然后重启电脑
3.设置mysql的账号和密码,并创建redmine数据库
[root@localhost ~]# mysql -uroot -p
Enter password:
#创建数据库
mysql> create database redmine character set utf8;
Query OK, 1 row affected (0.00 sec)
#
mysql> create user 'redmine'@'localhost' IDENTIFIED BY 'you01@';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on redmine.* to 'redmine'@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
4.安装rvm
[root@localhost ~]# curl -L get.rvm.io | bash -s stable
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 194 100 194 0 0 189 0 0:00:01 0:00:01 --:--:-- 190
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
100 24361 100 24361 0 0 9567 0 0:00:02 0:00:02 --:--:-- 28693
Downloading https://github.com/rvm/rvm/archive/1.29.4.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.4/1.29.4.tar.gz.asc
gpg: directory `/root/.gnupg' created
gpg: new configuration file `/root/.gnupg/gpg.conf' created
gpg: WARNING: options in `/root/.gnupg/gpg.conf' are not yet active during this run
gpg: keyring `/root/.gnupg/pubring.gpg' created
gpg: Signature made Mon 02 Jul 2018 03:41:26 AM CST using RSA key ID BF04FF17
gpg: Can't check signature: No public key
Warning, RVM 1.26.0 introduces signed releases and automated check of signatures when GPG software found. Assuming you trust Michal Papis import the mpapis public key (downloading the signatures).
GPG signature verification failed for '/usr/local/rvm/archives/rvm-1.29.4.tgz' - 'https://github.com/rvm/rvm/releases/download/1.29.4/1.29.4.tar.gz.asc'! Try to install GPG v2 and then fetch the public key:
gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
or if it fails:
command curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
the key can be compared with:
https://rvm.io/mpapis.asc
https://keybase.io/mpapis
NOTE: GPG version 2.1.17 have a bug which cause failures during fetching keys from remote server. Please downgrade or upgrade to newer version (if available) or use the second method described above.
#如果遇到以下报错,则执行报错中的gpg2 --recv-keys的命令。
[root@localhost ~]# gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
gpg: keyring `/root/.gnupg/secring.gpg' created
gpg: requesting key D39DC0E3 from hkp server keys.gnupg.net
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key D39DC0E3: public key "Michal Papis (RVM signing) <mpapis@gmail.com>" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
#再次执行命令curl -L get.rvm.io | bash -s stable
[root@localhost ~]# curl -L get.rvm.io | bash -s stable
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 194 100 194 0 0 193 0 0:00:01 0:00:01 --:--:-- 193
100 194 100 194 0 0 193 0 0:00:01 0:00:01 --:--:-- 193
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
100 24361 100 24361 0 0 9589 0 0:00:02 0:00:02 --:--:-- 39870
Downloading https://github.com/rvm/rvm/archive/1.29.4.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.4/1.29.4.tar.gz.asc
gpg: Signature made Mon 02 Jul 2018 03:41:26 AM CST using RSA key ID BF04FF17
gpg: Good signature from "Michal Papis (RVM signing) <mpapis@gmail.com>"
gpg: aka "Michal Papis <michal.papis@toptal.com>"
gpg: aka "[jpeg image of size 5015]"
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: 409B 6B17 96C2 7546 2A17 0311 3804 BB82 D39D C0E3
Subkey fingerprint: 62C9 E5F4 DA30 0D94 AC36 166B E206 C29F BF04 FF17
GPG verified '/usr/local/rvm/archives/rvm-1.29.4.tgz'
Creating group 'rvm'
Installing RVM to /usr/local/rvm/
Installation of RVM in /usr/local/rvm/ is almost complete:
* First you need to add all users that will be using rvm to 'rvm' group,
and logout - login again, anyone using rvm will be operating with `umask u=rwx,g=rwx,o=rx`.
* To start using RVM you need to run `source /etc/profile.d/rvm.sh`
in all your open shell windows, in rare cases you need to reopen all shell windows.
* Please do NOT forget to add your users to the rvm group.
The installer no longer auto-adds root or users to the rvm group. Admins must do this.
Also, please note that group memberships are ONLY evaluated at login time.
This means that users must log out then back in before group membership takes effect!
#以上表示执行成功,然后加载一下rvm命令。
[root@localhost ~]# source /usr/local/rvm/scripts/rvm
#查看rvm库中已知的ruby版本
[root@localhost ~]# rvm list known
# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-head] # security released on head
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p330]
[ruby-]1.9.3[-p551]
[ruby-]2.0.0[-p648]
[ruby-]2.1[.10]
[ruby-]2.2[.10]
[ruby-]2.3[.7]
[ruby-]2.4[.4]
[ruby-]2.5[.1]
[ruby-]2.6[.0-preview2]
ruby-head
# for forks use: rvm install ruby-head-<name> --url https://github.com/github/ruby.git --branch 2.2
# JRuby
jruby-1.6[.8]
jruby-1.7[.27]
jruby-9.1[.17.0]
jruby[-9.2.0.0]
jruby-head
# Rubinius
rbx-1[.4.3]
rbx-2.3[.0]
rbx-2.4[.1]
rbx-2[.5.8]
rbx-3[.100]
rbx-head
# TruffleRuby
truffleruby[-1.0.0-rc2]
# Opal
opal
# Minimalistic ruby implementation - ISO 30170:2012
mruby-1.0.0
mruby-1.1.0
mruby-1.2.0
mruby-1.3.0
mruby-1[.4.0]
mruby[-head]
# Ruby Enterprise Edition
ree-1.8.6
ree[-1.8.7][-2012.02]
# Topaz
topaz
# MagLev
maglev-1.0.0
maglev-1.1[RC1]
maglev[-1.2Alpha4]
maglev-head
# Mac OS X Snow Leopard Or Newer
macruby-0.10
macruby-0.11
macruby[-0.12]
macruby-nightly
macruby-head
# IronRuby
ironruby[-1.1.3]
ironruby-head
#5.安装Ruby
[root@localhost ~]# rvm install 2.4.1
#使用新版本
[root@localhost ~]# rvm use 2.4.1
Using /usr/local/rvm/gems/ruby-2.4.1
#查看当前版本
[root@localhost ~]# ruby --version
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
6.如果gem的源所在的网络不好,可以更改源
#[root@localhost ~]# gem update --system
Latest version already installed. Done.
[root@localhost ~]# gem -v
2.7.7
## 查看当前镜像源
[root@localhost ~]# gem sources -l
*** CURRENT SOURCES ***
https://rubygems.org/
#更新为国内源
#如果你使用 Gemfile 和 Bundler (例如:Rails 项目)
#你可以用 Bundler 的 Gem 源代码镜像命令。
[root@localhost ~]# gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/
https://gems.ruby-china.org/ added to sources
https://rubygems.org/ removed from sources
#再次查看源地址
[root@localhost ~]# gem sources -l
*** CURRENT SOURCES ***
https://gems.ruby-china.org/
#这样你不用改你的 Gemfile 的 source。
[root@localhost ~]# bundle config mirror.https://rubygems.org https://gems.ruby-china.org
7.安装rails 和 相关依赖包
[root@localhost ~]# gem install rails
[root@localhost ~]# gem install rake
#需要安装yum install mysql-devel
[root@localhost ~]# yum install mysql-devel
[root@localhost ~]# yum install libmysql-ruby libmysqlclient-dev
[root@localhost ~]# gem install mysql2
8.下载redmine并安装依赖
[root@localhost ~]# yum install ImageMagick-devel
[root@localhost ~]# useradd -s /sbin/nologin redmine
[root@localhost ~]# cd /usr/local/
[root@localhost local]# wget https://www.redmine.org/releases/redmine-3.4.6.tar.gz
[root@localhost local]# tar -zxvf redmine-3.4.6.tar.gz
[root@localhost local]# mv redmine-3.4.6 redmine && cd redmine
[root@localhost local]# chown -R root:root /usr/local/redmine
[root@localhost local]# cd redmine/
[root@localhost redmine]# bundle install
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
9.配置redmine并初始化 Redmine设置在config/configuration.yml的文件中定义。
[root@localhost redmine]# cd /usr/local/redmine/config/
[root@localhost config]# cp configuration.yml{.example,}
[root@localhost config]# cp database.yml{.example,}
##选择production部分修改数据库密码
[root@localhost config]# vim database.yml
Line indentation must be 2 spaces (no tabs).
production:
adapter: mysql2
database: redmine
host: localhost
username: root
password: ""
encoding: utf8
development:
adapter: mysql2
database: redmine_development
host: localhost
username: root
password: ""
encoding: utf8
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: mysql21,1Top
"database.yml" 51L, 1137C 2,1Top34,0-15,1 678910,123456789101234-- INSERT --10,14TopF"5o"6r"7y"8o"9u"200"11"2@"3411,1Topsocket=/tmp/mysql.sock23210198765432109 87654567/tmp/mysql.sock7:/tmp/mysql.sock87654321 socket:/tmp/mysql.socksocket:/tmp/mysql.socksocket:/tmp/mysql.socksocket:/tmp/mysql.socksocket:/tmp/mysql.socksocket:/tmp/mysql.socksocket:/tmp/mysql.sock34567891010
socket: /tmp/mysql.sock111,10Top:wq
"database.yml" 52L, 1172C written
#生成表结构
[root@localhost redmine]# RAILS_ENV=production bundle exec rake db:migrate
# 初始化数据选择zh
[root@localhost redmine]# RAILS_ENV=production 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]
====================================
Default configuration data loaded.
#权限设置:
[root@localhost redmine]# pwd
/usr/local/redmine
[root@localhost redmine]# mkdir -pv tmp tmp/pdf public/plugin_assets
[root@localhost redmine]# chown -R redmine:redmine files log tmp public/plugin_assets
[root@localhost redmine]# chmod -R 755 files log tmp public/plugin_assets
[root@localhost redmine]# rvm use 2.4.1
Using /usr/local/rvm/gems/ruby-2.4.1
[root@localhost redmine]# ruby --version
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
##10.启动redmine
[root@localhost redmine]# nohup /usr/local/rvm/rubies/ruby-2.4.1/bin/ruby /usr/local/redmine/bin/rails server -e production -b 0.0.0.0 >/dev/null 2>&1 &
[root@localhost redmine]# reboot