解决redis requires ruby version 2.3.0

CentOS7 yum库中ruby的版本支持到 2.0.0,但是gem安装redis需要最低是2.3.0,采用rvm来更新ruby

1.安装curl

yum -y install curl

2.安装rvm

gpg2 --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3  
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
100   194  100   194    0     0    242      0 --:--:-- --:--:-- --:--:--   242
100 24168  100 24168    0     0  10201      0  0:00:02  0:00:02 --:--:-- 42474
Downloading https://github.com/rvm/rvm/archive/1.29.8.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.8/1.29.8.tar.gz.asc
gpg: 于 2019年05月08日 星期三 22时14分49秒 CST 创建的签名,使用 RSA,钥匙号 39499BDB
gpg: 无法检查签名:没有公钥
GPG signature verification failed for '/usr/local/rvm/archives/rvm-1.29.8.tgz' - 'https://github.com/rvm/rvm/releases/download/1.29.8/1.29.8.tar.gz.asc'! Try to install GPG v2 and then fetch the public key:

    gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

or if it fails:

    command curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
    command curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -

In case of further problems with validation please refer to https://rvm.io/rvm/security

根据上面提示,安装前先执行

gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

3.修改 rvm下载 ruby的源,到 Ruby China 的镜像

gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/

4.查看rvm库中已知的ruby版本

rvm list known

5.安装一个ruby版本

rvm install 2.3.3

6. 使用一个ruby版本

rvm use 2.3.3

7.设置默认版本

rvm use 2.3.3 --default

8.卸载一个已知版本

rvm remove 2.0.0

9.查看ruby版本

ruby --version

 

你可能感兴趣的:(Redis)