Installing Ruby on cPanel

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:

tar -xvzf ruby-1.8.6.tar.gz
cd ruby-1.8.6
make install

Now, install the Gems and Rails:

tar -xvzf rubygems-0.9.0.tgz
cd rubygems-0.9.0
ruby setup.rb
gem install rails

Install Fast CGI

tar -xvzf fcgi-2.4.0.tar.gz
cd fcgi-2.4.0
make install

tar -xvzf mod_fastcgi-2.4.2.tar.gz
cd mod_fastcgi-2.4.2
/usr/local/apache/bin/apxs -o -c *.c
/usr/local/apache/bin/apxs -i -a -n fastcgi
gem install fcgi

Edit the Apache config file and add the fcgi module:

pico /usr/local/apache/conf/httpd.conf

LoadModule fastcgi_module libexec/
FastCgiIpcDir /tmp/fcgi_ipc/
AddHandler fastcgi-script .fcgi
< /IfModule>

Then restart Apache

Install RMagick and GetText:

tar -xvzf GraphicsMagick-1.1.7.tar.gz
cd GraphicsMagick-1.1.7
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:

Be Sociable, Share!

12 thoughts on “Installing Ruby on cPanel

  1. I believe there’s an error in your directions for httpd.conf

    The ifmodule entry should be more like this:

    FastCgiIpcDir /tmp/fcgi_ipc/
    AddHandler fastcgi-script .fcgi

    httpd won’t restart if you add what you have above.

  2. lol…the blog is filtering the entry. One more time:

    FastCgiIpcDir /tmp/fcgi_ipc/
    AddHandler fastcgi-script .fcgi

  3. The above instructions have worked for me many times, but keep in mind that all servers are configured differently, so these instructions may need to be modified for some people.

    Thanks for pointing that out though, someone else might have had an issue with fcgi before

  4. Vanessa! One question.
    Requires fastCGI?
    I only wish to install Ruby On Rails, my server already installed CGI.
    Addme to MSN (e-mail).
    Thanks for your help.
    A kiss!

  5. Just skip the fastcgi installation, it’s not required for Ruby.

    If you have yum, you can probably just do ‘yum install ruby’ to install just Ruby, then manually install your other modules.

  6. Hi Nessa, Thanks for the answer.
    So, I do the installation as follows:
    – First install Ruby
    – Install the Gems and Rails
    – I dont know how to do now with the file of Apache.
    Must be edited while it is not installed fcgi?.
    Then install RMagick and GetText
    – Install MySQL for Ruby
    And do with the before last step.

    If possible, and not a lot of serious trouble, I could please indicate, as do the installation excluding fcgi.

    I would be very helpful, write me to jalweb[@]

    Thank you very much!.

Leave a Reply

Your email address will not be published. Required fields are marked *