Installing Ruby on cPanel

Posted by Nessa | Posted in , | Posted on January 15, 2007

12

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/


Be Sociable, Share!

Comments (12)

nice

Wow, thanks for the tip! I’ll have to try this. :D

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.

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

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

Oh well, I tried… :)

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

your instructions were very helpful! thanks!

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!

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.

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[@]gmail.com.

Thank you very much!.

[…] If you’re more old-fashioned or are running a version of cPanel that does not have the installer, you can  find a manual installation tutorial here. […]

[…] link back to your site if you have relevent information to share. For example, I recently posted my Ruby on Rails tutorial on the cPanel forums, and suddenly I’m getting 100 more visitors a month from people […]

Post a comment