The script will be used directly for RedHat or CentOS distribution which used 'yum' for package management. Non-RH/CentOS users could simply modify the first line to use his own package manager.
NOTE: This is used by a root/admin user.
Install needed developer tools first.
yum install httpd-devel \
openssl-devel \
zlib-devel \
gcc \
gcc-c++ \
curl-devel \
expat-devel \
gettext-devel \
mysql-server \
mysql-devel
Then download,compile and install ruby. This used 1.8.7-p2. You could use newer version but good luck with it.
mkdir /usr/local/src
cd /usr/local/src
curl -O ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p72.tar.gz
tar xzvf ruby-1.8.7-p72.tar.gz
cd ruby-1.8.7-p72
./configure --enable-shared --enable-pthread
make
make install
Setup gems
cd ext/zlib
ruby extconf.rb --with-zlib-include=/usr/include --with-zlib-lib=/usr/lib
cd ../../
make
make installcd /usr/local/src
curl -O http://rubyforge.iasi.roedu.net/files/rubygems/rubygems-1.3.1.tgz
tar xzvf rubygems-1.3.1.tgz
cd rubygems-1.3.1
ruby setup.rb
Check version of ruby
ruby --version
Install needed gems (rails/passenger/sinatra)
gem install rails passenger sinatra
Then install/configure 'passenger' for apache. Follow thru the script.
passenger-install-apache2-module