Ruby环境
因为redis-trib.rb是有ruby语言编写的所以需要安装ruby环境。CentOS7 yum库中ruby的版本支持到 2.0.0,但是gem安装redis需要最低是2.3.0
# 离线安装
ruby安装包:https://ftp.ruby-lang.org/pub/ruby/3.0/
RubyGems:https://rubygems.org/pages/download
redis的gems包:https://rubygems.org/gems/redis/
上传到服务器,执行安装
./configure –prefix=/usr/local/ruby3.0.0
make && make install
1
2
3
2
3
安装RubyGems包管理器
# /opt/software/rubygems-3.2.28
ruby setup.rb
1
2
2
通过RubyGems包管理器安装redis-4.4.0.gem模块
gem install -l redis-4.4.0.gem
1
# 采用rvm来更新ruby
yum -y install curl
1
curl -L get.rvm.io | bash -s stable
1
如遇如下报错
[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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
根据上面提示,安装前先执行
gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
1
修改 rvm下载 ruby的源,到 Ruby China 的镜像
gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
1
查看rvm库中已知的ruby版本
rvm list known
1
安装一个ruby版本
rvm install 2.3.3
1
使用一个ruby版本
rvm use 2.3.3
1
设置默认版本
rvm use 2.3.3 --default
1
2
2
卸载一个已知版本
rvm remove 2.0.0
1