Wednesday, October 23, 2013

How to install ruby in cent os server

If you want to upgrade Packages then

sudo yum update

Follow this steps for installation for Ruby

Step 1 : Install recommended Packages 
sudo yum install build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev autoconf libc6-dev libncurses5-dev automake libtool bison subversion
then press 'y'

Step 2 : Install Git
sudo yum install curl git-core
then press 'y'

Step 3 : Install Ruby Version Manager(RVM)
bash < <(curl -sk https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
Step 4: Setup RVM
         
          echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"' >> ~/.bashrc

Step 5: 
source ~/.bashrc
Step 6 : Check for RVM installation
             It will gie output as "rvm is a function" 
 type rvm | head -1

Step 7 : Install Ruby with version 1.9.3
             You can change with different version
rvm install 1.9.3
If this command ask you for this:
A RVM version 1.23.12 (master) is installed yet 1.23.10 (master) is loaded.  
Please do one of the following:
* 'rvm reload' 
* open a new shell 
* 'echo rvm_auto_reload_flag=1 >> ~/.rvmrc' # for auto reload with msg. 
* 'echo rvm_auto_reload_flag=2 >> ~/.rvmrc' # for silent auto reload.
then do 'rvm reload' 

Step 8: Setup Default Ruby Version
           You can check all installed Ruby versions with command:
           rvm list
           then setup your needed Ruby Version with command:
           rvm use 1.9.3 --default
Step 9 : For check ruby installation is done or not with command…

ruby -v

2 comments: