1

I have a CentOS 5.3 machine which I want to run SASS. To do this, I need to update the version of Ruby on the system. I've tried multiple methods of doing this, but none have worked so far (including: How to update Ruby on CentOS 5.x & Install Ruby 1.9.3 with libyaml on CentOS)

After trying to update, when I run ruby -v and I'm still at 1.8.5. I've restarted Apache, the whole machine... to no avail. I was going to uninstall ruby but some of what I read said not to do that.

When I run those updates, there's no errors and everything seems to install fine. I did try this method How to setup Ruby and RubyGems on CentOS? which results in errors like file /usr/lib/ruby/1.8/yaml/types.rb from install of ruby-libs-1.8.7.352-5.el5.x86_64 conflicts with file from package ruby-libs-1.8.5-5.el5_4.8.i386

How do I get ruby updated?

user1337
  • 153
  • 2
  • 6
  • http://stackoverflow.com/a/6835131/631612 – quanta Jun 08 '12 at 04:13
  • Just ran that. All it did was completely break ruby. It doesn't seem to fully erase it, just enough to break the version that was there. – user1337 Jun 08 '12 at 15:45
  • How do you know it break the older version? Please show us the output. – quanta Jun 08 '12 at 15:55
  • When I tried to install the new version, I still got conflict errors: `file /usr/lib/ruby/1.8/yaml/types.rb from install of ruby-libs-1.8.7.352-5.el5.x86_64 conflicts with file from package ruby-libs-1.8.5-5.el5_4.8.i386` and `# ruby -v -bash: /usr/bin/ruby: No such file or directory` – user1337 Jun 08 '12 at 16:31
  • Which architecture are you running? 32-bit or 64-bit? If it is 64-bit, uninstall all the ruby-*.i386 packages and try again. – quanta Jun 08 '12 at 16:38
  • What's the proper way to uninstall? The method linked to above didn't work very well. – user1337 Jun 08 '12 at 16:42
  • `sudo yum remove ruby-*.i386`. – quanta Jun 08 '12 at 16:46
  • So easy, now I understand why my google results all seemed to gloss over that instruction. I tried that, but the volume is now full so I need to figure out how to clean it up. It's probably from the different ruby packages I've tried to DL and install... plus the volume is only 496MB to start. – user1337 Jun 08 '12 at 17:05
  • Ok, the above steps work to get you to 1.8.7. The key is removing all the ruby files and apparently you can't remove them if the volume is full. Thanks! – user1337 Jun 08 '12 at 17:18

2 Answers2

3

If you've run make install following those instructions, you've most likely put the new ruby into /usr/local/ somewhere.

When you run ruby -v you're most likely hitting the default ruby, which is probably in the PATH ahead of your brand new ruby. Check echo $PATH to see what it says.

You may also consider using rvm to manage the different ruby version.

Update:

If you don't want to use rvm, you should at least use package management, and install ruby 1.9.3 as an rpm. There doesn't seem to be any good repositories for ruby (though I only really searched for a few minutes), but look at these instructions:

https://github.com/imeyer/ruby-1.9.3-rpm

You probably need to remove the old 1.8 ruby first.

cjc
  • 24,533
  • 2
  • 49
  • 69
  • I installed as root. What directory do I need to be in when I run one of those install methods? – user1337 Jun 07 '12 at 17:40
  • The directory you're in wont' matter. The install path is set when you run `configure` with the right options. Anyway, this is not the best way to install ruby on a CentOS box. I'm updating my answer with what looks like a better way. – cjc Jun 07 '12 at 18:27
  • Thanks. I have no experience with RVM so I'll give the RPM a try. – user1337 Jun 07 '12 at 18:43
  • No luck. Same errors every time I get to the `rpmbuild -bb ruby19.spec` stage `Could not open file /root/rpmbuild/BUILD/ruby-1.9.3-p194/doc/capi/html/d5/d6d/_8ext_2include_2x86__64-linux_2ruby_2config_8h-source.html for writing make: *** [doc/capi/.timestamp] Error 1 error: Bad exit status from /var/tmp/rpm-tmp.54629 (%build) RPM build errors: Bad exit status from /var/tmp/rpm-tmp.54629 (%build) ` – user1337 Jun 07 '12 at 18:55
  • Hmm. How about this instead of just a spec file: http://rpmfind.net//linux/RPM/fedora/devel/rawhide/src/r/ruby-1.9.3.194-11.fc18.src.html Basically, download the referenced source RPM. You will get a .src.rpm file. You should be able to run `rpmbuild -ba ruby-1.9.3.194-11.fc18.src.rpm` and wind up with the binary RPMs in /usr/src/redhat/RPMS somewhere. You can then run `rpm -ihv` against those RPM files. – cjc Jun 07 '12 at 19:17
  • Unfortunately, that's over my head. Server admin is not my thing. I just want to get SASS running, which requires ruby. I'm not sure where to download that to. I'm trying not to muddy up the system by downloading a bunch of stuff and not even know where it's going or where it should go. – user1337 Jun 08 '12 at 16:36
  • Hmm. If that's the case, you should definitely look at RVM: https://rvm.io/rvm/install/ This will keep the ruby 1.9.3 installation in your home directory. There's also discussion here on how to do a system-wide rvm install: http://stackoverflow.com/questions/5421800/rvm-system-wide-install-script-url-broken-what-is-replacement – cjc Jun 08 '12 at 19:47
0

I agree with cjc. Additionally to find where your new ruby binary is you should have luck with this: sudo updatedb locate bin/ruby

paulusdd
  • 116
  • 2