解决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

  1. gpg2 --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
  2.  curl -L get.rvm.io | bash -s stable

遇到以下报错

  1.  [root@localhost ~]# curl -L get.rvm.io | bash -s stable
  2.    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
  3.                                   Dload  Upload   Total   Spent    Left  Speed
  4.  100   194  100   194    0     0    242      0 --:--:-- --:--:-- --:--:--   242
  5.  100 24168  100 24168    0     0  10201      0  0:00:02  0:00:02 --:--:-- 42474
  6.  Downloading https://github.com/rvm/rvm/archive/1.29.8.tar.gz
  7.  Downloading https://github.com/rvm/rvm/releases/download/1.29.8/1.29.8.tar.gz.asc
  8.  gpg: 2019年05月08日 星期三 22时14分49秒 CST 创建的签名,使用 RSA,钥匙号 39499BDB
  9.  gpg: 无法检查签名:没有公钥
  10.  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:
  11.   
  12.      gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
  13.  
  14.  or if it fails:
  15.   
  16.      command curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
  17.      command curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -
  18.  
  19.  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
posted @ 2020-09-01 16:16  MR__Wang  阅读(1798)  评论(0编辑  收藏  举报