redis requires Ruby version >= 2.3.0.

最近在研究redis的集群,redis官方提供了redis-trib.rb工具,但是在使用之前 需要安装ruby,以及redis和ruby连接:

yum -y install ruby ruby-devel rubygems rpm-build

gem install redis

其中 gem install redis命令执行时出现了:

Fetching: redis-4.1.2.gem (100%)
ERROR:  Error installing redis:
	redis requires Ruby version >= 2.3.0.

查了资料发现是Centos默认支持ruby到2.0.0,可gem 安装redis需要最低是2.3.0

解决办法是 先安装rvm,再把ruby版本提升至2.3.0

1.安装curl

yum install curl

2. 安装RVM  

curl -L get.rvm.io | bash -s stable  #看报错提示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: Signature made Wed 08 May 2019 10:14:49 PM CST using RSA key ID 39499BDB
gpg: Can‘t check signature: No public key
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 -

  

[root@ ~]# curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
gpg: keyring `/root/.gnupg/secring.gpg‘ created
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key D39DC0E3: public key "Michal Papis (RVM signing) <mpapis@gmail.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
gpg: no ultimately trusted keys found
[root@ ~]# curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -
gpg: key 39499BDB: public key "Piotr Kuczynski <piotr.kuczynski@gmail.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
[root@ ~]# 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    277      0 --:--:-- --:--:-- --:--:--   277
100 24168  100 24168    0     0   6932      0  0:00:03  0:00:03 --:--:-- 16690
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: Signature made Wed 08 May 2019 10:14:49 PM CST using RSA key ID 39499BDB
gpg: Good signature from "Piotr Kuczynski <piotr.kuczynski@gmail.com>"
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: 7D2B AF1C F37B 13E2 069D  6956 105B D0E7 3949 9BDB
GPG verified ‘/usr/local/rvm/archives/rvm-1.29.8.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!
Thanks for installing RVM ??
Please consider donating to our open collective to help us maintain RVM.

??  Donate: https://opencollective.com/rvm/donate

  

[root@ ~]# find / -name rvm.sh
/etc/profile.d/rvm.sh
[root@ ~]#  source /etc/profile.d/rvm.sh
[root@ ~]# rvm requirements
[root@ ~]# rvmsudo yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel

  

3. source /usr/local/rvm/scripts/rvm

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

rvm list known

5. 安装一个ruby版本

rvm install 2.3.3

6. 使用一个ruby版本

rvm use 2.3.3

7. 设置默认版本

rvm remove 2.0.0

8. 卸载一个已知版本

ruby --version

9. 再安装redis就可以了

gem install redis

文章来自:https://www.cnblogs.com/Camiluo/p/10996934.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3