I have just re-installed Ruby on Rails on my CentOS 5.X machine. Good thing I don't delete my history on the browser and so I was able to find the tutorial I follow on how to do it.

So just in case this happens to me again, I'll be posting here the steps on how to do it.

  1. Remove all ruby installed to your system. Type this at the console

    (NOTE: all the steps from here onward are entered as admin)

    yum list | grep installed | grep ruby

    Your server might return these lines after, although some may not be existing on your system:

    ruby.i386 1.8.5-5.el5_3.7 installed
    ruby-devel.i386 1.8.5-5.el5_3.7  installed
    ruby-libs.i386 1.8.5-5.el5_3.7 installed
    ruby-mode.i386 1.8.5-5.el5_3.7 installed
    

    Now we need to remove it in order to install a new one. To remove it just type the following:

    yum erase ruby
    yum erase ruby-devel
    yum erase ruby-libs
    yum erase ruby-mode

    NOTE: Unable to do so, will affect your ruby application.

    Based on experience, I accidentally re-installed my ruby and it causes my applications to stop working. It returns the following error:

    Rails requires RubyGems >= 1.3.2. Please install RubyGems and try  again: http://rubygems.rubyforge.org

    I'm still checking this, if multiple ruby installation is really the effect of this error.

  2. Download and install Enterprise Ruby
    ( http://www.rubyenterpriseedition.com/download.html )

    mkdir -p ~/Temp/Sources
    cd ~/Temp/Sources
    wget http://rubyforge.org/frs/download.php/68719/ruby-enterprise-1.8.7-2010.01.tar.gz
    tar xzvf ruby-enterprise-1.8.7-2010.01.tar.gz
    ./ruby-enterprise-1.8.7-2010.01/installer
    

    At the end we should have a working Ruby installation.
    Let's create some useful link.

    ln -s /opt/ruby-enterprise-1.8.7-2010.01/bin/rake /usr/bin/rake
    ln -s /opt/ruby-enterprise-1.8.7-2010.01/bin/gem /usr/bin/gem
    ln -s /opt/ruby-enterprise-1.8.7-2010.01/bin/rails /usr/bin/rails
    ln -s /opt/ruby-enterprise-1.8.7-2010.01/bin/ruby /usr/bin/ruby
    ln -s /opt/ruby-enterprise-1.8.7-2010.01/bin/irb /usr/bin/irb
    

    Congratulations! You have now ruby on rails on your CentOS!

    Try the following to confirm:

    ruby -v
    ruby 1.8.7 (2009-12-24 patchlevel 248) [i686-linux], MBARI 0x8770, Ruby Enterprise Edition 2010.01
    rails -v
    Rails 2.3.8
    gem -v
    1.3.5
    

No comments :

Post a Comment