Do not yum for ruby, cause you’ll get 1.8.5.
Follow these steps to get everything installed: http://www.catapult-creative.com/2009/02/04/installing-rails-on-centos-5/
Then create a passenger virtualhost:
<VirtualHost *:80>
DocumentRoot /var/www/railstest/public
ServerName railstest.cosninix.com
RailsBaseURI /
RailsEnv development
<Directory "/var/www/railstest/public">
allow from all
Options -MultiViews
</Directory>
</VirtualHost>
Watch: railsEnv is mandatory! This is not in the passenger doc but gives you a 500-internal server error if missing.
Now go to /var/www and create your rails app (and use mysql as well)
rails new railstest -d mysql
restart httpd and we should see the generated index.html, but that is still static html processed so no rails nor ruby is actually used.
Now remove index.html from railstest/public and generate a test controller:
rails generate controller home index
And change the default route (config/routes.rb) for the root: (search for root, it is already there but commented out)
Blog::Application.routes.draw do root :to => "home#index"<VirtualHost *:80> DocumentRoot /var/www/sinatratest/public ServerName sinatratest.cosninix.com RackEnv production <Directory "/var/www/sinatratest/public"> allow from all Options -MultiViews </Directory> </VirtualHost>
require 'rubygems'
require 'sinatra'
set :environment, :production
disable :run, :reload
require 'testje'
run Sinatra::Application
This is for the latest sinatra version (1.2.0) as some methods has changed names and/or became class methods.
now create a small file testje.rbin (also in the sinatratest dir)
get '/' do
"hello world, my name is Frank"
end
Restart httpd and this should work. You now have a working rails and sinatra deployment on centos with passenger.
One tip: Instead of restarting httpd all the time it is easier to create a tmp dir and use
touch tmp/restart.txt
every time you changed something. This will trigger passenger to reload everything

Great post!
You post informative articles Just bookmarked !!!
restart httpd and we should see the generated index.html, but that is still static html processed so no rails nor ruby is actually used.
+1
Hi there, just became aware of your blog through Google, and found that it is truly informative. I am going to watch out for brussels. I will appreciate if you continue this in future. Many people will be benefited from your writing. Cheers!
Great article indeed. We possess been awfully scouting around to the good tips.
This is the perfect site for anybody who would like to find out about this topic. You realize a whole lot its almost tough to argue with you (not that I personally would want to…HaHa). You certainly put a fresh spin on a subject that’s been discussed for many years. Excellent stuff, just wonderful!
Greetings! Very helpful advice in this particular article! It is the little changes that produce the largest changes. Many thanks for sharing!