最近研究redis,所以对电脑安装ruby。现整理如下
yum安装
sudo yum install ruby
安装完成后查看版本号
ruby -v
ruby 2.0.0p648 (2015-12-16) [x86_64-linux]
版本对应新版redis,低了
对ruby做升级
安装RAM,依次执行命令
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
curl -sSL https://get.rvm.io | bash -s stable
[parallels@10 redis-6.0.8]$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
[parallels@10 redis-6.0.8]$ curl -sSL https://get.rvm.io | bash -s stable
curl: (7) Failed connect to raw.githubusercontent.com:443; 拒绝连接
这里悲催的是https://get.rvm.io被墙了,无法访问,所以我这里科学上网,把命令上传到我的服务器上。
通过连接下载http://www.wangfan.xyz/rvm-installer.sh 然后到本地执行就好了
用命令下载到本地:wget http://www.wangfan.xyz/rvm-installer.sh
[parallels@10 redis-6.0.8]$ wget http://www.wangfan.xyz/rvm-installer.sh
--2020-09-23 13:03:40-- http://www.wangfan.xyz/rvm-installer.sh
正在解析主机 www.wangfan.xyz (www.wangfan.xyz)... 94.191.120.218
正在连接 www.wangfan.xyz (www.wangfan.xyz)|94.191.120.218|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:25472 (25K) [application/x-sh]
正在保存至: “rvm-installer.sh”
100%[==============================================================================>] 25,472 --.-K/s 用时 0.03s
2020-09-23 13:03:41 (744 KB/s) - 已保存 “rvm-installer.sh” [25472/25472])
下载到本地rvm-installer.sh字符集因为是dos的,所以需要修改字符集
vim rvm-installer.sh
set ff=unix 强制修改为unix的字符集
赋个可执行权限
chmod 777 rvm-installer.sh
运行命令
./rvm-installer.sh
下载安装
[parallels@10 redis-6.0.8]$ ./rvm-installer.sh
Downloading https://github.com/rvm/rvm/archive/master.tar.gz
Installing RVM to /home/parallels/.rvm/
Adding rvm PATH line to /home/parallels/.profile /home/parallels/.mkshrc /home/parallels/.bashrc /home/parallels/.zshrc.
Adding rvm loading line to /home/parallels/.profile /home/parallels/.bash_profile /home/parallels/.zlogin.
Installation of RVM in /home/parallels/.rvm/ is almost complete:
* To start using RVM you need to run `source /home/parallels/.rvm/scripts/rvm`
in all your open shell windows, in rare cases you need to reopen all shell windows.
Thanks for installing RVM
Please consider donating to our open collective to help us maintain RVM.
Donate: https://opencollective.com/rvm/donate
安装成功
按照提示执行
source /home/parallels/.rvm/scripts/rvm
运行指令查看ruby版本
rvm list known
[parallels@10 redis-6.0.8]$ rvm list known
#MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-head] # security released on head
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p330]
[ruby-]1.9.3[-p551]
[ruby-]2.0.0[-p648]
[ruby-]2.1[.10]
[ruby-]2.2[.10]
[ruby-]2.3[.8]
[ruby-]2.4[.10]
[ruby-]2.5[.8]
[ruby-]2.6[.6]
[ruby-]2.7[.1]
ruby-head
#for forks use: rvm install ruby-head-<name> --url https://github.com/github/ruby.git --branch 2.2
#JRuby
jruby-1.6[.8]
jruby-1.7[.27]
jruby-9.1[.17.0]
jruby[-9.2.13.0]
jruby-head
#Rubinius
rbx-1[.4.3]
rbx-2.3[.0]
rbx-2.4[.1]
rbx-2[.5.8]
rbx-3[.107]
rbx-4[.20]
rbx-5[.0]
rbx-head
#TruffleRuby
truffleruby[-20.2.0]
#Opal
opal
#Minimalistic ruby implementation - ISO 30170:2012
mruby-1.0.0
mruby-1.1.0
mruby-1.2.0
mruby-1.3.0
mruby-1[.4.1]
mruby-2.0.1
mruby-2[.1.1]
mruby[-head]
#Ruby Enterprise Edition
ree-1.8.6
ree[-1.8.7][-2012.02]
#Topaz
topaz
#MagLev
maglev-1.0.0
maglev-1.1[RC1]
maglev[-1.2Alpha4]
maglev-head
#Mac OS X Snow Leopard Or Newer
macruby-0.10
macruby-0.11
macruby[-0.12]
macruby-nightly
macruby-head
#IronRuby
ironruby[-1.1.3]
ironruby-head
选择安装2.7版本
rvm install 2.7
[parallels@10 program]$ rvm install 2.7
Searching for binary rubies, this might take some time.
No binary rubies available for: centos/7/x86_64/ruby-2.7.1.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for centos.
Installing requirements for centos.
Installing required packages: bison, libffi-devel, readline-devel, sqlite-devel, zlib-devel, openssl-devel..parallels password required for 'yum install -y bison libffi-devel readline-devel sqlite-devel zlib-devel openssl-devel':
..............................
Requirements installation successful.
Installing Ruby from source to: /home/parallels/.rvm/rubies/ruby-2.7.1, this may take a while depending on your cpu(s)...
ruby-2.7.1 - #downloading ruby-2.7.1, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
80 14.0M 80 11.3M 0 0 9685 0 0:25:16 0:20:25 0:04:51 11153
curl: (18) transfer closed with 2813156 bytes remaining to read
Partial file(18). Only a part of the file was transferred. Removing partial and re-trying.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 14.0M 100 14.0M 0 0 396k 0 0:00:36 0:00:36 --:--:-- 278k
Checking fallback: https://ftp.ruby-lang.org/pub/ruby/2.7/ruby-2.7.1.tar.bz2
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 14.0M 100 14.0M 0 0 2087k 0 0:00:06 0:00:06 --:--:-- 2188k
ruby-2.7.1 - #extracting ruby-2.7.1 to /home/parallels/.rvm/src/ruby-2.7.1.....
ruby-2.7.1 - #configuring.......................................................................
ruby-2.7.1 - #post-configuration..
ruby-2.7.1 - #compiling...............................................................................................
ruby-2.7.1 - #installing.................................
ruby-2.7.1 - #making binaries executable...
Installed rubygems 3.1.2 is newer than 3.0.8 provided with installed ruby, skipping installation, use --force to force installation.
ruby-2.7.1 - #gemset created /home/parallels/.rvm/gems/ruby-2.7.1@global
ruby-2.7.1 - #importing gemset /home/parallels/.rvm/gemsets/global.gems................................................-
ruby-2.7.1 - #generating global wrappers.......
ruby-2.7.1 - #gemset created /home/parallels/.rvm/gems/ruby-2.7.1
ruby-2.7.1 - #importing gemsetfile /home/parallels/.rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.7.1 - #generating default wrappers.......
ruby-2.7.1 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.7.1 - #complete
Ruby was built without documentation, to build it run: rvm docs generate-ri
[parallels@10 program]$ ruby -v
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]
最后ruby版本 2.7,安装成功,
按照网上教程来也是可以,唯一搞的就是https://get.rvm.io无法访问,一直在报错
Failed to connect to raw.githubusercontent.com port 443: Operation timed out
谁知道TMD白装了
WARNING: redis-trib.rb is not longer available!
You should use redis-cli instead.
All commands and features belonging to redis-trib.rb have been moved
to redis-cli.
In order to use them you should call redis-cli with the --cluster
option followed by the subcommand name, arguments and options.
Use the following syntax:
redis-cli --cluster SUBCOMMAND [ARGUMENTS] [OPTIONS]
Example:
redis-cli --cluster help
To get help about all subcommands, type:
redis-cli --cluster help