Here’s how to install Ruby on Rails on a cPanel system:
Update: These instructions were modified for Ruby 1.8.6, since 1.8.5 is no longer available!
First install Ruby:
wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6.tar.gz
tar -xvzf ruby-1.8.6.tar.gz
cd ruby-1.8.6
./configure
make
make install
Now, install the Gems and Rails:
wget http://rubyforge.org/frs/download.php/11289/rubygems-0.9.0.tgz
tar -xvzf rubygems-0.9.0.tgz
cd rubygems-0.9.0
ruby setup.rb
gem install rails
Install Fast CGI
wget fastcgi.com/dist/fcgi-2.4.0.tar.gz
tar -xvzf fcgi-2.4.0.tar.gz
cd fcgi-2.4.0
./configure
make
make install
wget fastcgi.com/dist/mod_fastcgi-2.4.2.tar.gz
tar -xvzf mod_fastcgi-2.4.2.tar.gz
cd mod_fastcgi-2.4.2
/usr/local/apache/bin/apxs -o mod_fastcgi.so -c *.c
/usr/local/apache/bin/apxs -i -a -n fastcgi mod_fastcgi.so
gem install fcgi
Edit the Apache config file and add the fcgi module:
pico /usr/local/apache/conf/httpd.conf
LoadModule fastcgi_module libexec/mod_fastcgi.so
FastCgiIpcDir /tmp/fcgi_ipc/
AddHandler fastcgi-script .fcgi
< /IfModule>
Then restart Apache
Install RMagick and GetText:
wget http://umn.dl.sourceforge.net/sourceforge/graphicsmagick/GraphicsMagick-1.1.7.tar.gz
tar -xvzf GraphicsMagick-1.1.7.tar.gz
cd GraphicsMagick-1.1.7
./configure
make
make install
Install MySQL for Ruby:
gem install mysql
Now make the test Installation. To do this, log in as your user (not root)
su user
cd ~
rails test
cd public_html
ln -s ../test/public/ rails
cd ../test/
chmod -Rf 777 tmp/
cd public
chmod 755 dispatch.fcgi
pico .htaccess
Now, find the line in the .htaccess that looks something like this:
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
And change “dispatch.cgi” to “dispatch.fcgi”
To see if you’ve installed everything properly, just browse to the Rails folder:
http://yourdomain.com/rails/