CentOS update Ruby

文章目录
  1. 1. If you already installed ruby and ruby-devel packages with yum before, remove them first before upgrading Ruby.
  2. 2. Build and install the latest Ruby from the source as follows.
  3. 3. Finally, update Rubygems and Bundler.
  4. 4. If you have any pre-installed gems with an older version of Ruby, update the gems.
  5. 5. To use the installed Ruby/Rubygems, open a new terminal. Then check the version of installed Ruby and Rubygems as follows.

安装redis启动集群时发现这样的报错,

./redis-trib.rb create 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7001 127.0.0.1:7002
Creating cluster
Connecting to node 127.0.0.1:7000: [ERR] Sorry, can't connect to node 127.0.0.1:7000

查一些资料大概意思是ruby 和gem 版本太低,安装新版本。

If you already installed ruby and ruby-devel packages with yum before, remove them first before upgrading Ruby.

sudo yum remove ruby ruby-devel

Build and install the latest Ruby from the source as follows.

sudo yum groupinstall "Development Tools"
sudo yum install openssl-devel
wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz
tar xvfvz ruby-2.1.2.tar.gz
cd ruby-2.1.2
./configure
make
sudo make install

Finally, update Rubygems and Bundler.

sudo gem update --system
sudo gem install bundler

If you have any pre-installed gems with an older version of Ruby, update the gems.

sudo gem update

To use the installed Ruby/Rubygems, open a new terminal. Then check the version of installed Ruby and Rubygems as follows.

ruby --version
rubygems --version