Centos7 install and upgrade Ruby

background

When doing the redis cluster, you need to use Ruby tools to operate. It is found that the version of ruby installed online is too low, and the version supported by redis is at least 2.2.2

 

Install ruby Online

Install ruby online using yum with version 2.0.0.

yum install ruby

ruby -v

Add ruby repository

  1. Add aliyun image and check Ruby Version
gem sources -a http://mirrors.aliyun.com/rubygems/ 

ruby -v

Install RAM

RAM(Ruby Version Manager ) is a command-line tool for RAM, which can be used to easily install and manage Ruby Version. RVM includes Ruby Version Management and Gem library management (gemset)

You can use the following command to install RAM:

gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

curl -sSL https://get.rvm.io | bash -s stable

The following message appears to indicate successful installation:

Update the profile to take effect immediately:

source /etc/profile.d/rvm.sh

View the RVM version information, if it can represent a successful installation.

rvm -v

Next, look at the Ruby Version:

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[.7]
[ruby-]2.4[.4]
[ruby-]2.5[.1]
[ruby-]2.6[.0-preview2]
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.0.0]
jruby-head

# Rubinius
rbx-1[.4.3]
rbx-2.3[.0]
rbx-2.4[.1]
rbx-2[.5.8]
rbx-3[.100]
rbx-head

# TruffleRuby
truffleruby[-1.0.0-rc2]

# 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.0]
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]

Install Ruby, and find any information higher than version 2.2.2 from the above:

rvm install 2.5

The following message appears, indicating successful installation:

Validation version:

Upgrade succeeded.

Note:

If you use rvm to install and find that the download is slow, you can consider deleting the original warehouse address and retaining only the alicloud image.

gem sources --remove https://rubygems.org/

 

Tags: Ruby Redis yum github

Posted on Tue, 31 Dec 2019 09:43:53 -0800 by mark_kccs