How to Install Ruby Enterprise Edition and Passenger Phusion (mod_rails) on CentOS/RHEL x86_64

INSTALL SYSTEM PREREQUISITES

Install the prerequisite development headers. If this is a production system, make note of all the packages installed, for future removal.

# yum install apr-devel.x86_64 apr-util-devel.x86_64 curl-devel.x86_64 gcc-c++.x86_64 httpd-devel.x86_64 mysql-devel.x86_64 mysql-server.x86_64 openssl-devel.x86_64 zlib-devel.x86_64

INSTALL RUBY ENTERPRISE EDITION

First, install the End Point yum repository:

# yum update m2crypto
# curl -O https://packages.endpoint.com/rhel/5/os/x86_64/endpoint-repo-1.0-1.x86_64.rpm
# yum --nogpgcheck install endpoint-repo-1.0-1.x86_64.rpm

Next, install Ruby and RubyGems:

# yum install ruby-enterprise ruby-enterprise-rubygems
# nano /etc/gemrc

gem: --no-ri --no-rdoc

INSTALL PHUSION PASSENGER (MOD_RAILS)

First, install the Phusion-provided Passenger repository for CentOS:

# curl -O http://passenger.stealthymonkeys.com/rhel/5/passenger-release.noarch.rpm
# yum --nogpgcheck install passenger-release.noarch.rpm

Next, install Passenger:

# gem install passenger
# passenger-install-apache2-module

CONFIGURE APACHE

# nano /etc/httpd/conf.d/mod_rails.conf

LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.2/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.2
PassengerRuby /usr/local/bin/ruby

# nano /etc/httpd/conf.d/myrailsapp.conf

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /var/www/myrailsapp/public
    ServerName dummy-host.example.com
    ErrorLog /var/www/myrailsapp/log/error_log
    CustomLog /var/www/myrailsapp/log/access_log common

    # mod_rails
    <Directory /var/www/myrailsapp/public>
      RailsEnv production
      Options -Multiviews
    </Directory>
</VirtualHost>

# service httpd restart

RAILS 3 + BUNDLER

# gem update --system
# gem install bundler
# gem install mysql -- --with-mysql-config=/usr/lib64/mysql/mysql_config
# cd /var/www/myrailsapp
# bundle install --without development test
# touch log/production.log
# chgrp apache log/*
# chmod g+w log/*

REMOVE DEVELOPMENT PACKAGES

If you just deployed to a production environment, you probably don’t want compilers, development libraries, headers or packagers leaving you vulnerable to a rootkit exploit:

# yum remove *-devel *-headers gcc-c++ cpp gcc libgomp pkgconfig

ACKNOWLEDGEMENTS

Deploying to a Virtual Host’s Root. Phusion Passenger User’s Guide. 5 Dec. 2010.

Packaging Ruby Enterprise Edition into RPM. Vollrath, Adam. End Point. 16 Jun. 2009.

This entry was posted in essays and tagged , , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>