How to install Ruby on Rails on Centos 6

I’ve had trouble finding a decent guide on installing Ruby in Centos 6. There are a few good guides out there but none quite did the trick for me, whether it’s changes in Centos or just a different system setup I don’t know but this is what worked for me.


yum update
yum -y groupinstall "Development Tools"
yum -y install ntp zlib zlib-devel sqlite-devel httpd mysql-server mysql-devel curl-devel httpd-devel apr-devel apr-util-devel mlocate manlibxml2-devel libxslt-devel libffi-devel readline-devel

Install rvm

sudo curl | bash -s stable

source /etc/profile.d/

Install ruby, gems and rails

rvm install 1.9.3

rvm use 1.9.3 --default

ruby --version

gem install rails

Install Passenger

gem install passenger


The final command will output something like the below, just do as it suggests.

Please edit your Apache configuration file, and add these lines:

LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p448/gems/passenger-4.0.17/buildout/apache2/
PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p448/gems/passenger-4.0.17
PassengerDefaultRuby /usr/local/rvm/wrappers/ruby-1.9.3-p448/ruby

After you restart Apache, you are ready to deploy any number of Ruby on Rails
applications on Apache, without any further Ruby on Rails-specific

Press ENTER to continue.

Deploying a Ruby on Rails application: an example

Suppose you have a Rails application in /somewhere. Add a virtual host to your
Apache configuration file and set its DocumentRoot to /somewhere/public:
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /somewhere/public

# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
And that's it! You may also want to check the Users Guide for security and
optimization tips, troubleshooting and other useful information:

/usr/local/rvm/gems/ruby-1.9.3-p448/gems/passenger-4.0.17/doc/Users guide Apache.html

Enjoy Phusion Passenger, a product of Phusion ( :-)

Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.

Like this Article? Share it!

About the Author

Author Gravatar

Andy has been in IT support in the academic industry for over 7 years now, with an in-depth knowledge of both Windows and Unix based systems.

Related Posts


  1. Am I correct that RVM generally installs only for individual users and not all users? I.e. it installs in a user’s directory and not a system directory?

    I like the layout of your instructions. Very nice indeed.


    • Hi Nelson,

      Thanks, glad you like the layout 🙂 I try to make the guides as easy to read as possible – no ones like a wordy guide.

      As for RVM, I think in this case it’s on the system. For ease I tend to do things as root, especially in this case where it was for a user who I didn’t want to have sudo access.


  2. Hi Andy,

    How about installing RoR with rbenv and phusion passenger?


  3. Thanks for this; I think I might have finally found a working tutorial. 😀

  4. Hi Andy,
    Thanks for this nice tutorial. I folowing your steps and every thing was done without error but my apache cant interpreting any ruby or RoR app from server can you help me what i can do in httpd.conf or where i can found some reason why apache doesn’t work?

    Thanks for your time.

Leave a Comment