Installing Phusion’s Passenger on CentOS (for Ruby 1.9)

As a prerequisite you have to have installed Ruby 1.9.x on your CentOS system.

If you don’t know how to do it, follow the instructions on this post:

Installing Ruby 1.9 on CentOS

Once you are ready follow the next steps:

On a terminal type:

gem install passenger

$ passenger-install-apache2-module

This last command is going to walk you through the process of installation,

helping you install whatever is missing on your system and at the end giving the instructions

to “patch” your apache’s configurations file.

passenger-install-appache2-module

On my case, I had to install the following modules:

$ yum install httpd-devel

$ yum install apr-devel

$ yum install apr-util-devel

After installing them re-run the command again

$ passenger-install-apache2-module

And then edit the apache configuration

/etc/httpd/conf/httpd.conf

Ad the following lines to the file:

LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2
PassengerRuby /usr/local/bin/ruby
And finally configure your VirtualDirectories (on the same file)
<VirtualHost *:80>
ServerName ruby.1oc.com
DocumentRoot “/var/www/virtualhost/ruby.1oc.com/web/public”
<Directory “/var/www/virtualhost/ruby.1oc.com/web/public”>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
Now reboot the apache server
$ /etc/init.d/httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
Now you are ready to go.
Test the site http://ruby.1oc.com/
ruby.1oc.com