12

I have a CentOS 5.5 (64-bit server)

I'd like to install Ruby 1.8.7 (current patch level) and RubyGems

What's the best way to go about this?

disclaimer: I'm a CentOS noob

macek
  • 315
  • 2
  • 4
  • 10

2 Answers2

17

You can install it with default yum install -y ruby ruby-devel rubygems

Other way is to compile it by yourself

Ruby

wget http://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p302.tar.gz
tar -zxvf ruby-1.8.7-p302.tar.gz
cd ruby-1.8.7-p302
./configure --with-openssl-dir=/usr/lib/openssl
make
make install

Rubygems

wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz
tar -zxvf rubygems-1.3.7.tgz
cd rubygems-1.3.7
ruby setup.rb config
ruby setup.rb setup
ruby setup.rb install

Check if installed

ruby -v
gem -v
NARKOZ
  • 918
  • 3
  • 14
  • 23
  • NARKOZ, installing via packages is desired. My repository is only showing Ruby 1.8.5... :( – macek Oct 29 '10 at 21:40
  • Actually, my repository doesn't even have a match for `rubygems`. – macek Oct 29 '10 at 21:43
  • 1
    Then you should compile it yourself, follow instructions above. If you installed ruby 1.8.5, remove it with command `yum erase ruby`. – NARKOZ Oct 29 '10 at 21:46
  • 1
    NARKOZ, I'm running into even more trouble. Patch level 302 of Ruby 1.8.7 does not have the `--with-openssl-dir` flag available for `configure`. – macek Oct 29 '10 at 22:03
  • install it `yum install openssl openssl-devel` – NARKOZ Oct 29 '10 at 22:17
  • that's not the issue. We have openssl, but `--with-openssl-dir` is not a valid flag for `configure`. – macek Oct 29 '10 at 22:20
  • see what returns `which openssl`. try `./configure --with-openssl-dir=/usr/bin/openssl`. at least you can do just `./configure` – NARKOZ Oct 29 '10 at 22:26
  • `--with-openssl-dir` is also not a valid configure option for this version of Ruby – Collin Allen Jan 15 '21 at 18:32
1

In what capacity are you trying to use Ruby? If you don't need it systemwide, Have you considered using RVM locally so you can install ruby into your local directory? Additionally you can install rvm systemwide. It takes some doing, but it's a better solution that tossing files across your server.

Installing RVM

I'd test it out first in your local directory until you get comfortable with it.

kashani
  • 3,922
  • 18
  • 18