How to install Ruby on Rails on CentOS 6.4

Ruby_On_Rails_logoRuby is a dynamic, reflective, general-purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features.

Before installing Ruby on our machine we have to update our system and have to install some dependency applications.

Now we can proceed for Ruby installation
Download and install ruby as below step

After completing the installation verify the ruby version:

Now we will download and install rubygem

Now we will ensure that we have the latest gem with us by issuing below command:

Output:

Now we will install latest version of rails with it’s dependencies:

Verify the installed gems

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS
The following two tabs change content below.

Tapas Mishra

Sr. Engineer (DevOps)
Loves to work on Opensource products. Having experience on Linux environment. Knowledge on Public cloud services like AWS, Rackspace, DigitalOcean, Linode. Please don't hesitate to give a comment on the posts. Your comments are my strength.

12 thoughts on “How to install Ruby on Rails on CentOS 6.4

  1. Hi

    this its the version 2.0,help me to uninstal that version or update the 2.0 to 4.0

    Many thanks

    • Hi Tanas,

      In this article I have used the rubygem version 2.0.6. Currently the latest version is 2.1.5. To update the rubygems you can issue the command “sudo gem update –system”. Then install rails 4.0 by issuing the command “gem install rails” or “sudo gem install rails –version 4.0.0”. To uninstall all old gems use the command “sudo gem cleanup”. If you want to verify before cleanup then just issue the command “sudo gem cleanup -d” it will list you all old gem with their dependency. Then you can clean your old gems.

      Thanks!

  2. Good job,But while i install gem an error occures rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in require': cannot load such file -- openssl (LoadError)
    I think gem has been installed properly.
    But when i tried to install rails

    ERROR: Loading command: install (LoadError)
    cannot load such file -- openssl
    ERROR: While executing gem ... (NoMethodError)
    undefined method
    invoke_with_build_args’ for nil:NilClass

    • Hi Vivek,

      The error is coming due to the package openssl. Please try installing these required packages. “ yum install gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel”. Let me know if you still have issues after installing these packages.

      -Tapas

      • Hi Tapas,

        Well done mate..Super response too ! im sorry to respond when i got the solution.What you said is right,i have installed openssl but no openssl-devel.Solved by installing openssl-devel through yum and recompile ruby.
        Thanks again !

  3. Hi,

    I use same method but on (make & make install command) i got following errors:

    make[2]: *** [ossl_pkey_ec.o] Error 1
    make[2]: Leaving directory /opt/ruby-2.0.0-p247/ext/openssl'
    make[1]: *** [ext/openssl/all] Error 2
    make[1]: Leaving directory
    /opt/ruby-2.0.0-p247′
    make: *** [build-ext] Error 2

    Means Ruby is not installed, please suggest me whats wrong here?

    • Hi Sarfra,

      Please try to install yum install gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel. After installing the dependencies try again to make and make install.

  4. Hi Tapas

    I am trying to install ruby-2.0.0-p247 on Centos6.5.
    I have followed your instruction and installed all the following packages:

    yum groupinstall “Development Tools”
    yum install gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel

    Everything is installed and then tried to install the ruby. I am getting the following error while issuing the command “make”

    “compiling ossl_pkey_ec.c
    ossl_pkey_ec.c: In function âossl_ec_group_initializeâ:
    ossl_pkey_ec.c:766: warning: implicit declaration of function âEC_GF2m_simple_methodâ
    ossl_pkey_ec.c:766: warning: assignment makes pointer from integer without a cast
    ossl_pkey_ec.c:821: error: âEC_GROUP_new_curve_GF2mâ undeclared (first use in this function)
    ossl_pkey_ec.c:821: error: (Each undeclared identifier is reported only once
    ossl_pkey_ec.c:821: error: for each function it appears in.)
    make[2]: *** [ossl_pkey_ec.o] Error 1
    make[2]: Leaving directory /root/ruby-2.0.0-p247/ext/openssl'
    make[1]: *** [ext/openssl/all] Error 2
    make[1]: Leaving directory
    /root/ruby-2.0.0-p247′
    make: *** [build-ext] Error 2″

    I am stuck and unable to move further.
    I would greatly appreciate it if you Could you please advise what is going wrong with my installation?

    Regards
    Jo

Leave a Reply