Solve ruby Installation Problems: redis requires Ruby version & amp, rubyredis
I. Problem Description
Today, we set up a redis cluster and encountered a problem when installing ruby and redis interface programs: redis requires Ruby version> = 2.2.2., as shown below:
[root@localhost ~]# gem install redis-4.0.0.gem ERROR: Error installing redis-4.0.0.gem: redis requires Ruby version >= 2.2.2.
Ii. Cause
This is because the Centos7 yum Library only supports ruby version 2.0, but the interface program between ruby and redis needs to be installed later than 2.2, so an error is reported.
[root@localhost ~]# ruby -vruby 2.0.0p648 (2015-12-16) [x86_64-linux]
Iii. Solution
First install rvm and then upgrade ruby to 2.3.3
1. Install rvm (just enter the following command)
gpg2 --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3curl -L get.rvm.io | bash -s stablesource /usr/local/rvm/scripts/rvm
If curl is not installed, install curl first.
[root@localhost ~]# sudo yum install curl
2. Install the new version
[root@localhost ~]# rvm install 2.3.3
3. The new version is used by default.
[root@localhost ~]# rvm use 2.3.3 --defaultUsing /usr/local/rvm/gems/ruby-2.3.3
4. Uninstall the old version
[root@localhost ~]# rvm remove 2.0.0ruby-2.0.0-p648 - #already goneUsing /usr/local/rvm/gems/ruby-2.3.3
5. Check the ruby version again.
[root@localhost ~]# ruby -vruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]
6. You can install the interface program between ruby and redis.
[root@localhost ~]# gem install redis-4.0.0.gemSuccessfully installed redis-4.0.0Parsing documentation for redis-4.0.0Installing ri documentation for redis-4.0.0Done installing documentation for redis after 1 seconds1 gem installed