Ruby on Rails Centos 6.x beginners installation guide!

Ruby on Rails Centos Installation Guide!

For my ruby on rails centos server, I installed a fresh Centos 6.3 minimal.

Ruby on Rails Centos



Install Ruby

yum install ruby

yum install ruby-devel ruby-irb ruby-rdoc ruby-ri


Option 1: Install Rubygems using yum

this is the easy way. install from source if you have problems or you need the more recent rubygems version.

yum install rubygems


Option 2: Install Rubygems from sources

access the latest available gems by visiting:

remember to ‘yum remove rubygems’ if you’ve installed rubygems earlier using yum.

mkdir ~/src

cd ~/src


tar xzvf rubygems-1.8.24.tgz

rm rubygems-1.8.24.tgz -f

cd rubygems-1.8.24

ruby setup.rb


Update Rubygems

gem update

gem update --system

make sure you have gcc and make installed. it’s used by gem and needed to install gems like sqlite3-ruby

yum install gcc gcc-c++ make -y


Install Rails

gem install rails -V

-V for details of the process

verify with

rails --version


ERROR: Error installing rails:
activesupport requires Ruby version >= 1.X.X.

If you get this error while installing rails you need to

yum remove ruby

and then install it from source (check if newer versino exist):

cd /opt
yum groupinstall “development tools”
tar -zxvf  ruby-2.1.0.tar.gz
cd ruby-2.1.0.tar.gz
make install

# and then some cleaning…
cd ..
rm ruby-2.1.0.tar.gz

You can also use easier methods like rbenv or RVM.

It will install rubygems too for you.

then try to install rails again.


That’s it!

you have ruby on rails (rails) installed!

you have gem package manager installed. you can view installed packages with:

gem list


What’s now?



You will probably need an sql. Rails version 2.0+ uses sqlite3 as its default database – you can, of course, use others

yum install sqlite-devel

After you have sqlite installed, install the gem with:

gem install sqlite3-ruby



to test you have installed everything as needed do the following test using irb:


#irb(main):001:0> require 'rubygems'

=> true

#irb(main):002:0> require 'sqlite3'

=> true


Creating your First Project

Using an SQLite3 database for data storage is a zero configuration database that just works. ‘db::rake’ will create the database.

cd ~/

rails new project

cd project

rake db:create


Javascript runtime

rails default project template uses CoffeeScript. Compiling CoffeeScript to JavaScript requires a JavaScript runtime. without it running the server will return an execjs error.


Install TheRubyRacer

gem install therubyracer

Rails adds the therubyracer gem to Gemfile in a commented line for new apps and you can uncomment if you need it.

therubyrhino is the recommended runtime for JRuby users and is added by default to Gemfile in apps generated under JRuby.

also, from rails 3 you can use node.js for compiling the coffeescript.

edit the ‘Gemfile‘ file inside your new project directory and uncomment (delete the #) from the line 

# gem ‘therubyracer’ ….


gem ‘therubyracer’ ….

save.. and your project should now work.


Start Server

bundle install

rails server

Installing Ruby on Rails on Centos 6.3 is Easy!

if everything correct, This will fire up WEBrick web-server (Rails can also use several other web servers like apache or nginx). To see your application in action, open a browser window and navigate to http://localhost:3000. You should see Rails default page.



Read more…

read the full ruby on rails guide: Getting Started with Rails. you have everything installed and ready for this guide 🙂


read more on web-servers in iTekBlog:

1 thought on “Ruby on Rails Centos 6.x beginners installation guide!

  1. jj

    This is a no go.
    On most unix distros this way of installing ruby will completely make your ruby installation outdated and not useful at all for any serious development.

    If you only plan to play a bit with some ruby code it might be ok, but if you already know that you are going to dive into rails or some other cool ruby stuff then you need to install ruby with RVM (Ruby Version Manager)
    Official page & install instructions here:
    A nice and light tutorial here
    The second one also better explains why using apt-get or yum will make your ruby outdated and kind of broken (you will not be able to use some gems, get latest rails, and so on…)


Leave a Reply

Your email address will not be published.


This site uses Akismet to reduce spam. Learn how your comment data is processed.