[root@redmine ~]# yum install openssl-devel gdbm gdbm-devel readline readline-devel gcc gcc-c++
# 2.4.1
https://www.ruby-lang.org/en/news/2017/03/22/ruby-2-4-1-released/
# 2.5.3
https://www.ruby-lang.org/en/news/2018/10/18/ruby-2-5-3-released/
[root@redmine ~]# tar zxf ruby-2.4.1.tar.gz
[root@redmine ~]# cd ruby-2.4.1
[root@redmine ruby-2.4.1]# ./configure --prefix /usr/local/ruby-2.4.1
[root@redmine ruby-2.4.1]# make && make install
[root@redmine ruby-2.4.1]# tail -2 /etc/profile
RUBY_HOME=/usr/local/ruby-2.4.1
export PATH=$PATH:$RUBY_HOME/bin
[root@redmine ruby-2.4.1]# source /etc/profile
[root@redmine ~]# ruby -v
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
[root@redmine ~]# gem sources --remove https://rubygems.org/ -a https://gems.ruby-china.com/
[root@redmine ~]# gem update --system
# 如出现报错 -- 需按照对应提示完成对应依赖安装
[root@redmine ~]# gem install rails --version 5.2.5
# 依赖报错 -- nokogiri 错误
[root@redmine ~]# gem install rails --version 5.2.3
Fetching: nokogiri-1.13.8-x86_64-linux.gem (100%)
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
bad response Forbidden 403 (https://gems.ruby-china.com/quick/Marshal.4.8/nokogiri-1.13.8-x64-unknown.gemspec.rz)
# 解决办法 -- 安装 nokogiri
[root@redmine ~]# gem install nokogiri -v 1.6.2.1
[root@redmine ~]# rails -v
Rails 5.2.5
[root@redmine ~]# gem install bundler
Fetching: bundler-2.3.19.gem (100%)
bundler's executable "bundle" conflicts with /usr/local/ruby-2.4.1/bin/bundle
Overwrite the executable? [yN] y
Successfully installed bundler-2.3.19
Parsing documentation for bundler-2.3.19
Installing ri documentation for bundler-2.3.19
Done installing documentation for bundler after 0 seconds
1 gem installed