Installing, switch and manage Rails2 and Rails3 on Centos 5-6

March 31, 2011 | By Regaz | Filed in: Uncategorized.

Before the installation of Rubies on Rails we need
to Prepare our system by installing some prerequisite’s stuff.
All work is supposed to be make by a ordinary $ user…

  1. Install Prerequisite stuff

    sudo yum install sqlite-devel

    Prepare for git installation:

    sudo yum install zlib-devel openssl-devel perl cpio expat-devel gettext-devel

    If you haven’t Curl installed follow this:

    wget http://curl.haxx.se/download/curl-7.18.0.tar.gz
    tar xzvf curl-7.18.0.tar.gz
    cd curl-7.18.0
    ./configure
    make
    sudo make install

    Next you need to put a reference of /usr/local/lib on your
    ld.so.conf because Git has to know your Curl’s version…

    sudo nano /etc/ld.so.conf

    Insert the line below:

    /usr/local/lib

    Save your file and then execute:

    sudo /sbin/ldconfig

    Now you can finnaly proceed to set the right repository for the following tasks and to install git:

    sudo rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x8664/epel-release-latest-5-4.noarch.rpm 
    sudo yum install git
  2. Install of rvm
    bash < <( curl -k https://rvm.beginrescueend.com/releases/rvm-install-head )

    Next you need to put the path of rvm in terminal and in your .profile

    source $HOME/.rvm/scripts/rvm
    echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> $HOME/.profile

    Now you provide to close re-open your terminal window or to open a new tab and check that rvm has been correctly installed

    rvm -v

    Next you provide to look for post-installation requirements executing:

    rvm notes

    You should find marked a list of post-install tasks like:
    $ yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel
    Now you can proceed to add this stuff:

    sudo yum install -y gcc-c++ patch readline-devel zlib-devel libyaml-devel libffi-devel openssl-devel

    After you have accomplished your post-install tasks you are now ready to begin using rvm to install Rubies on Rails :)  

  3. Install of Ruby 1.8.7 and Rails 2.3.8

    Use rvm to install ruby 1.8.7 by:

    rvm install 1.8.7

    We select by rvm to use ruby 1.8.7:

    rvm use 1.8.7

    (If your work is almost of time based on Rails2 you can provide to add the option --default) Now you can check your ruby version by

    ruby -v

    Need result --> ruby 1.8.7... After that we will provide to install Rails 2.3.8. Install Rails 2.3.8:

    rvm gem install -v=2.3.8 rails

    Now there will need a little correction of our gem's version if rvm provide to install a set than isn't good for our Rails version... Download, untar and install rubygems 1.5.0:

    wget http://rubyforge.org/frs/download.php/74140/rubygems-1.5.0.tgz

    Untar it:

    tar zxvf rubygems-1.5.0.tgz

    Install it:

    cd rubygems-1.5.0
    ruby setup.rb

    Now check your gem version by:

    gem -v

    Will give you a result of 1.5.0 You can now test than your Rails2 is effectively working by looking than

    rails test

    will generate a rails scheme.

  4. Install of Ruby 1.9.2 and Rails 3
     

    rvm install 1.9.2
    rvm use --default 1.9.2
    ruby -v

    Need result --> ruby 1.9.2...

    rvm gem install --pre rails
    rails -v

    Need result --> rails > 3 Finally, provide to test your Rails3 is effectively working

    rails new ./testrails3

    Will give you a default application.

  5. Before You leave Just Check... this.


    Bloogger Blogger, Google Blogger, Google Google

    Feel Better on Debian Linux

All Bests
Davide


Tags: , , , , , , ,

QuickChic Theme • Powered by WordPress