Trouble running RubyGems on Redhat 5.5 - ruby

Am trying to install Ruby and RubyGems on a RedHat 5.5 machine. I'd got them by running the following two commands:
sudo yum install ruby
sudo yum install rubygems
Got both installed. However when i try to run gem, i got the following error:
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require': undefined methodend_with?' for "no such file to load --
Win32API":String (NoMethodError)
from /usr/lib/ruby/site_ruby/1.8/rubygems/config_file.rb:55
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in
gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:inrequire'
from /usr/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:8
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in
gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:inrequire'
from /usr/bin/gem:9
Doesn't matter what kind of command i run, it throws that. (I tried gem -v, gem update)
The version of Ruby seems to be 1.8 but i have problem determining the RubyGems version. I'd vi into rubygems.rb and at the top it stats the version as 1.5.
Try to fix by running the downgrade command as proposed here, but it throws the same error as well.
Any help on fixing this issue? Just want to get this running so that i can run a RoR apps..

RedHat 5 ships with Ruby 1.8.5 and an equally old rubygems. Both, the rubygems and the ruby version is WAY too old to be supported by anything outside the base packages of the OS anymore. Even in the OS packages, they probably won't change anything on their own due to the age of their whole system.
If you really want/have to use Ruby on Red Hat 5, you probably need to get another source for it that the RPMs provided by the OS, e.g. rbenv / ruby-build or ruby-install or even rvm. You should use a newer Ruby version, i.e. a 2.1 or 2.2 version. All Ruby versions < 2.0 are unsupported by the language developers by now.
Alternatively, you should try to use a newer version of RedHat, i.e. RedHat 7 which doesn't need to support to 8 year old software...

Suspicious here is that yum installed ruby 1.8 which is pretty outdated version, it seems you have two versions of ruby on your system now and gem tries to use the old one.
Check the version of the package installed recently and try to force rubygems to use the new version(by removing the old ruby or linking to the path returned by which ruby)

Related

Why is ruby -v still showing version 2.0.0 even after successfully installing ruby 2.5.3?

I'm following this tutorial: https://jekyllrb.com/docs/installation/macos/#homebrew
I've successfully installed ruby 2.5.3, however, when I run "ruby -v" on the command line in Terminal, it still says ruby 2.0.0.
My friend told me something about local vs universal installation of ruby and how that can create a conflict, but I'm completely new to this so I'm having trouble understanding how to update the 2.0.0 to 2.5.3 (which I've successfully installed on my machine).
I suggest you install RVM: https://rvm.io/
The install instruction is on the site.
After you're done installing RVM do.
rvm install 2.5.3
Then test with ruby -v to check if you have the version you want (2.5.3). If not we can help you from that point.

Ruby upgrade from 1.8.5 to 1.8.7 and make all programs understand to use the newer version

Here is a question related to Ruby.
The Express Installation of OpenNebula 2.2.0 on CentOS has caused me big problems, since it installs Ruby 1.8.5, which is incompatible with Sunstone.
I installed Ruby 1.9.2 after executing the Express installation, but the problem remained, since Sunstone tried to use the old Ruby-installation.
I don't know how to configure, so that the newer Ruby-version should be used instead.
After this problem I reinstalled CentOS and installad Ruby 1.8.7.
When I do ruby -v, it shows:
ruby 1.8.7 (2010-12-23 patchlevel 330).
But when I do 'gem update –system', it says
(Gem::InstallError)
rubygems-update requries Ruby Version >= 1.8.7.. An older version was installed before from the CentOS-repository (for yum install) and apparently the GEM install doesn't understand that I have installed a newer version.
So my question is:
How should I configure my system so that all programs will understand to use Ruby 1.8.7 ?
Thanks!
Anders Branderud
I suggest to try using Ruby Version Manager
bash < <(curl -s https://rvm.ioinstall/rvm)
and then, or even better before :), read some documentation about rvm.

Is it possible to install RubyGems on Ruby 1.8.6?

I'm trying to install RubyGems on a Fedora-based distribution that only has Ruby 1.8.6. I downloaded the RubyGems 1.6.2 package, unzipped and ran
$ ruby setup.rb
It bombs out with the rather unhelpful error message:
./lib/rubygems/custom_require.rb:54: warning: parenthesize argument(s) for future version
./lib/rubygems/custom_require.rb:57:in `require': undefined method `end_with?' for "no such file to load -- Win32API":String (NoMethod\
Error)
from ./lib/rubygems/config_file.rb:55
from ./lib/rubygems/custom_require.rb:36:in `gem_original_require'
from ./lib/rubygems/custom_require.rb:36:in `require'
from ./lib/rubygems/gem_runner.rb:8
from ./lib/rubygems/custom_require.rb:36:in `gem_original_require'
from ./lib/rubygems/custom_require.rb:36:in `require'
from setup.rb:25
Looking at the source of the exception, it seems that it first tries:
require "etc"
Etc.sysconfdir
and when that throws a NoMethodError it tries to require Win32API (which I assume isn't present on linux).
I'm guessing that this could be because I have an old version of Ruby, but I can't find the RubyGems version requirements documented anywhere. Can anyone suggest how to proceed with this?
How about installing RVM? Then you can manage multiple Ruby versions easily and, maybe, install a more recent version of Ruby. It works really well.
It is definitely possible to install RubyGems on Ruby 1.8.6, but not RubyGems 1.6.2. Support for Ruby 1.8.6 was dropped in RubyGems 1.4.0.
Why are you trying to circumvent your Linux distribution's package manager? They test interoperability between the packages they ship precisely to avoid situations like this.
In general, it is not a good idea to mix different package management systems. Ideally, you shouldn't be using RubyGems at all, when using Linux, since most distribution's package management systems are as good as RubyGems anyway. RubyGems is only needed on operating systems like Windows or OSX which are still stuck in the 1980s.
Thats what I do on my Redmine installation, for example: I just use the distribution packages of Rails, RedCloth, RMagick, Rack, Redmine, Ruby Enterprise Edition, Phusion Passenger, and whatever else I need. I don't even have RubyGems installed at all, neither from a distribution package nor from source.
If, however, for some reason, you need RubyGems, then you should move your entire Ruby environment out of the distribution package manager and manage it yourself. Just install whatever version and flavor of Rubinius, JRuby, IronRuby, YARV or whatever you want, install the latest version of RubyGems from source (or don't, since all of the above already ship with one pre-installed anyway) and install all of your Ruby libraries as Gems.
As was noted in other answers, RVM can be of help, but is generally unnecessary unless you want to manage multiple Ruby installations on the same machine.
You can't install RubyGems greater than 1.3.5 if you only have Ruby version 1.8.5.
RubyGems requires at least Ruby 1.8.6 to install.
My background:
- I have RubyGems 1.3.5 installed in
my CentOS Linux because Ruby is 1.8.6.
- What I did with Mac OS X, which comes
with Ruby 1.8.7, is to upgrade gem
from version 1.3.5 to version 1.6.2
by using the original gem.

Omniauth (net-ldap requires Ruby version >= 1.8.7.) installation error?

I'm trying crazily to install omniauth on Ubuntu 8.04.4.
I keep getting the following error:
ERROR: Error installing omniauth:
net-ldap requires Ruby version >= 1.8.7.
So I updated to Ruby1.9 but still the error persists. Any idea of why this is happening?
I thought ruby1.8.7 was a minor release, so best practice would suggest moving to Ruby1.9. Further, and more to the point, I can't find a copy of Ruby1.8.7 anywhere.
EDIT:::::::::::::::
I purged the gems and uninstalled ruby. Then found a version ruby1.8.7, compiled and installed and now it works great.
Cheers,
Slotishtype.
I guess since you have "updated" and not removed the old Ruby version, the gems would be installed to old path where the old Ruby version was installed.
You can verify the same using the command
gem env
in the terminal. And following the path to where your gems are currently installed.
Also you can check if you have the correct ruby version installed as per your requirement with
ruby -v
Try removing the old version and then installing a fresh version of Ruby.
You would find Ruby 1.8.7 from http://www.ruby-lang.org/en/downloads/.
Good Luck!!
Hope it helps.

update ruby to 1.8.7

I'm working on a project that i have to use ruby 1.8.7. I'm using today, ruby 1.8.6 + Mac OSX Darwin. This ruby 1.8.6 was installed with the OS, it's a developer package from Apple. My question is: how can i update this package? if i run ports, it dont find my current installed package and install a new ruby version, with different paths and as effect it breaks my rubygems (i know how to fix it, but it is always workarounds over workarounds).
There is a clean way to update the default ruby that comes with the OS or its better to remove it and just manage it by Port? Please answer like this one How to update to Ruby 1.8.7 don't helps me
Have you tried rvm gem? It manages Ruby versions installed, allow to compile most (if not all) actual (and archival) Ruby versions, sets proper environment variables pointing to actually used ruby version.
$ gem install rvm
$ rvm install 1.8.7
$ rvm use 1.8.7 --default
On my OS X machines I have several versions of Ruby installed.
I install then, from source, under /usr/local/ruby-1.X.X
Once you have multiple versions of Ruby installed you will need your environment to know which one to use.
I do this by setting the PATH, like so
export PATH="/usr/local/ruby-1.8.7/bin:$PATH";
See Hive Logic's article on installing Ruby

Resources