Lets see how to install Passenger on Cent OS. Cent OS 5.1 comes with Apache 2.2.3 installed. First of all make sure Ruby, Gems, Rails and ruby development headers is installed on the system, Issue following commands as root:
yum install rubyyum install irbyum install rdocyum install ruby-develyum install rubygems
Now install rails gems:
gem install rails -y
Also install Apache development header files.
yum install httpd-devel
Now we have all prerequisites covered. Lets proceed with installation of Passenger gem.
gem install passenger
After installing passenger and its dependencies make sure that Apache is stopped, launch passenger installer for Apache module from command line.
passenger-install-apache2-module
The command line based installer is pretty good it will check all dependencies and inform you if any dependency is missing. After the module is installed. create a rails application in /var/www/htdocs folder.
rails demo
Now open httpd.conf file in /etc/httpd/conf folder. Add following lines in this file.
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.0.1/ext/apache2/mod_passenger.soPassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.0.1PassengerRuby /usr/bin/ruby
These paths could be different for your system. Now lets configure virtual host for rails application at bottom of httpd.conf. Add these lines at bottom of file:
<VirtualHost *:80>ServerName www.demo.comDocumentRoot /var/www/html/myapp/public</VirtualHost>
Make sure DocumentRoot points to public directory of your rails application. Also add server name alias to hosts file in /etc/ folder. Now start apache server from console.
service httpd start
Your new rails application should be running now with Phusion Passenger.