0

How to upgrade ruby to a new version in RHEL.

When I try - sudo yum install ruby It says

Package ruby-2.0.0.648-33.el7_4.x86_64 already installed and latest

version Nothing to do

When I try - sudo yum install @ruby2.5 It says,

Loaded plugins: fastestmirror, langpacks Repository 'UIM_install' is

missing name in configuration, using id Repository 'debug' is missing

name in configuration, using id Repository nodesource is listed more

than once in the configuration Repository nodesource-source is listed

more than once in the configuration Repository 'opencl' is missing

name in configuration, using id Loading mirror speeds from cached

hostfile Group ruby2.5 does not exist. Error: Nothing to do

I need the latest ruby in my system. What is the solution?

Edit:

I tried sudo yum update ruby and gave the following response.

Loading mirror speeds from cached hostfile

No packages marked for update

6
  • did you try with yum update ruby Jan 2, 2020 at 9:17
  • Yes, it says - Loading mirror speeds from cached hostfile No packages marked for update
    – Codeformer
    Jan 2, 2020 at 9:18
  • In such case I will not recommend to go further. You can update by hand but you will create good mess with the packages. And this can lead to nonfunctional ruby installation. Jan 2, 2020 at 9:20
  • Okay, but I need a newer version of Ruby as some of the libraries that are used by the project needs later version.
    – Codeformer
    Jan 2, 2020 at 9:22
  • 1
    You can get Ruby 2.6 as part of RedHat Software Collections. These packages will install into alternate directories, so they can co-exist with the base ruby. Jan 2, 2020 at 10:33

3 Answers 3

0

You can get newer versions of ruby through Red Hat Software Collections.

Once you have the rhscl repo installed you can install the ruby SCL packages. These packages live along side the version of Ruby installed from the base repos, so you won’t use /usr/bin/ruby. The “rh-ruby25” SCL includes Ruby 2.5 but there’s also a Ruby 2.6 (rh-ruby26) if you want a newer one.

The advantage of using SCL is that it is supported by red hat, it gets installed by yum like everything else, and you get security updates. The downside is that it lives along side the base ruby so you need to be careful to load the SCL before using it. Instructions are in the link provided.

0

In general, I never attempt to use the versions of Ruby (or Rails) packaged on any Linux distro, they are almost always too old for what I need - instead, I download whatever version I need using RVM. If you do this, you'll need to install the newer version of Ruby into a different directory than the distro-provided Ruby, and then you can put that directory into your $PATH ahead of the distro-provided binaries if you wish.

-1

Redhat and centos does not provided the latest version of the various software. This because are LTS (long terms support) operative system. Only security and minor upgrades are released. In order to install an higher version of the software it's better to compile from your self and DON'T REPLACE THE EXISTING VERSION. This because (maybe) the operative system rely on script/tools written with the old particular version. Changing with a different one maybe break something.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .