Install Ruby 1.8.7, Rubygems, and Passenger on CentOS5 64-bit

Here's a quick tutorial on how to compile and install Ruby 1.8.7, Rubygems, and Passenger on CentOS 5 64-Bit. You'll need a few dependencies first. If you have any problems, let me know in the comments and I'll see if I can help.


Ruby 1.8.7

yum install httpd-devel openssl-devel zlib-devel gcc gcc-c++ curl-devel expat-devel gettext-devel mysql-server mysql-devel wget nano

START MYSQLD

/etc/init.d/mysqld start

mysqladmin -u root password securepassword

cd /usr/local/src

wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p174.tar.gz

tar xvzf ruby-1.8.7*.tar.gz

cd ruby-1.8.7*

./configure --enable-shared --enable-pthread

make

make install

cd ext/zlib

ruby extconf.rb --with-zlib-include=/usr/include --with-zlib-lib=/usr/lib64

cd ../../

make

make install

ruby --version


Ruby Gems

cd /usr/local/src

wget http://rubyforge.org/frs/download.php/70696/rubygems-1.3.7.tgz

tar xvzf rubygem*.tgz

cd rubygem*

ruby setup.rb

gem install rubygems-update

update_rubygems


Ruby on Rails

gem install rails


Passenger/Apache

yum install httpd

gem install passenger

passenger-install-apache2-module

nano /etc/httpd/conf.d/passenger.conf

Add these lines:

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

ctrl+x then y and Enter to save

/etc/init.d/httpd restart