ruby升级版本

ruby版本过低,需要升级版本

正常情况安装--但是网络不好,你是安装不上去得

yum install ruby ruby-devel rubygems rpm-build
source /root/.bash_profile 
source /etc/profile 

安装Ruby和Redis的接口
gem install redis
Fetching: redis-4.1.3.gem (100%)
ERROR:  Error installing redis:
			redis requires Ruby version >= 2.3.0.

安装RVM,解决Ruby版本过低
yum install curl -y
gpg2 --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
curl -L get.rvm.io|bash -s stable
curl -L get.rvm.io | bash -s stable
curl -sSL https://get.rvm.io | bash -s stable
curl -L  get.rvm.io | bash -s stable
gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
command curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
command curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -
curl -L  get.rvm.io | bash -s stable
source /root/.bash_profile 
source /etc/profile 
rvm list known
rvm install 2.3.8
rvm use 2.3.8 --default 

安装Ruby和Redis的接口
gem install redis

本人测试最快得方法

[root@localhost ~]# yum -y install ruby ruby-devel rubygems rpm-build

安装yum源

[root@localhost ~]# yum install -y centos-release-scl-rh

安装指定版本的ruby

[root@localhost ~]# yum install -y rh-ruby24

使升级后的配置生效

scl enable rh-ruby24 bash

[root@localhost ~]# ruby -v

至此 ruby 升级至 v2.4 完毕

原文地址:https://www.cnblogs.com/dinghc/p/14184980.html