安装Ruby

安装

yum -y install ruby rubygems
 

查看版本

ruby --version 
ruby 2.0.0p648 (2015-12-16) [x86_64-linux]

 

由于centos系统默认支持Ruby版本为2.0.0,因此执行gem install redis命令时会报以下错误。

[root@kube-node-1 src]# gem install redis
Fetching: redis-4.0.1.gem (100%)
ERROR:  Error installing redis:
    redis requires Ruby version >= 2.2.2.
解决方法是先安装rvm,再升级ruby版本。

curl -sSL https://get.rvm.io | bash -s stable
结果出现以下错误:

Downloading https://github.com/rvm/rvm/archive/1.29.7.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.7/1.29.7.tar.gz.asc
gpg: Signature made Fri 04 Jan 2019 06:01:48 AM 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.7.tgz' - 'https://github.com/rvm/rvm/releases/download/1.29.7/1.29.7.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
安装rvm出现公钥问题
根据提示,预先执行:
gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

再执行安装

OK完美解决

 

然后执行以下命令。

source /usr/local/rvm/scripts/rvm
查看rvm库中已知的ruby版本

rvm list known
例如:

 

升级Ruby

#安装ruby
rvm install  2.4.0
#使用新版本
rvm use  2.4.0
#移除旧版本
rvm remove 2.0.0
#查看当前版本
ruby --version
完成
--------------------- 
作者:NPException 
来源:CSDN 
原文:https://blog.csdn.net/qq_36850813/article/details/88179564 
版权声明:本文为博主原创文章,转载请附上博文链接!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值