getting ruby, rails, passenger on my centos box

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:

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"
now restart httpd and you should see rails at work.
Then it might be nice to have a sinatra setup as well.
Create another virtual server, this time it is called sinatratest:

Also here, the RackEnv is mandatory!
Now create the sinatratest dir and a public dir.
Leave the public dir empty, it is a placeholder for now but can be filled with javascript files and css etc.
Create a file called config.ru in the sinatratest dir (this is a rack definition file that passenger accepts)

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)

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

every time you changed something. This will trigger passenger to reload everything