Thu 17 Aug 2006
there is no cpaddon module for rails, so you gotta get your hands dirty. This is the fast way I got it to run, I will makes notes where needed. This is current as of August 2006 with the latest “stable” cpanel WHM.
As the root user, install ruby, gems, rails, fcgi, mod_fastcgi and add a configuration line to http.conf and restart as follows ( condensed from: here):
$ cd /usr/local/src $ wget ftp.ruby-lang.org/pub/ruby/ruby-1.8.4.tar.gz $ tar -xvzf ruby-1.8.4.tar.gz $ cd ruby-1.8.4 $ ./configure && make && make install $ cd /usr/local/src $ wget rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz $ tar -xvzf rubygems-0.8.11.tgz $ cd rubygems-0.8.11 $ ruby setup.rb $ gem install rails $ cd /usr/local/src $ 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 $ cd /usr/local/src $ 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 $ mkdir -p /tmp/fcgi_ipc $ chown nobody.nobody /tmp/fcgi_ipc -R $ chmod 755 /tmp/fcgi_ipc -R
Then in /etc/httpd/conf/httpd.conf add
LoadModule fastcgi_module libexec/mod_fastcgi.so <IfModule mod_fastcgi.c>
FastCgiIpcDir /tmp/fcgi_ipc/
AddHandler fastcgi-script .fcgi
< /IfModule>
install any other gems you want like rmagick and gettext and then restart apache however you like.. Remember if you install a gem you must restart apache to be able to use it.
Now to actually get rails running, follow what I have done with this domain use your own user
$ su people $ cd ~ $ rails test $ cd public_html $ ln -s ../test/public/ rails $ cd ../test/ $ chmod -R 777 tmp/ $ cd public $ chmod 755 dispatch.fcgi $ vim .htaccess
chmod -R a+rwx tmp is probably better than 777, but it is an afterthought to just getting this done
Change “dispatch.cgi” to “dispatch.fcgi”
Load up http://peoplesdns.com/rails/
One of the main issues I have seen from people is that they get it running but if the tmp directory is not writable then rails pukes and gives a bunch of errors, this seems to fix the issue.
An easy way to make rails standards would be to wrap /usr/bin/rails in a shell script by renaming rails to “runrails” and then having the rails script handle this, along with setting a “_RAILS” dir in the users folder and creating all projects inside that.
if you want to use mysql (duh)
gem install mysql
if you don`t do the above, rails doesn`t panic it starts spitting out “Lost connection to MySQL server during query” errors all over which really tells you nothing.. so make sure and install the mysql gem and save yourself some headaches.
install whatever other gems you want
Then if you actually want to use your gems, you must
/etc/init.d/httpd restart
it is sort of like installing anything on windows, you gotta reboot the whole thing.
Anyway, though that might come in handy for someone.
September 17th, 2006 at 6:43 am
I cant seem to get it to work,
The moment I put
FastCgiIpcDir /tmp/fcgi_ipc/
AddHandler fastcgi-script .fcgi
and try to restart httpd, I get a configuration file error!
QuoteDecember 12th, 2006 at 12:08 am
I have the same problem, any explanation?
QuoteDecember 12th, 2006 at 12:24 am
[…] Installing Ruby on Rails on top of Cpanel through SSH […]
QuoteDecember 12th, 2006 at 12:25 am
[…] Installing Ruby on Rails on top of Cpanel through SSH […]
QuoteDecember 31st, 2006 at 11:48 am
are you using apache2? if so, then mod_fastcgi needs to be linked by apxs2 or apxs in the apache2 dir. (it is helpful to read the install for apache2 in the mod_fastcgi dir to see how it is done)
Also, apache may need to be rebuilt through cpanel making sure that it has cgi and anything related to cgi built into it.
good luck
QuoteFebruary 3rd, 2007 at 5:58 am
Make sure that you dont forget the slash at the end: http://peoplesdns.com/rails/ !!
http://peoplesdns.com/rails wont work!
QuoteFebruary 3rd, 2007 at 6:41 am
I just wonder what needs to be change if you want your app to be at http://peoplesdns.com/ ?
QuoteFebruary 12th, 2007 at 6:55 pm
You could use the cpanel installer
Quotessh as root
cd /scripts
./installruby
you’ll get Ruby - On - Rails Installed once it’s complete
All configured and ready to run with apache
April 13th, 2007 at 11:26 pm
for those who get a configuration error after restarting apache, make sure there is no space in
it should be
joeldg you might want to correct that in your howto. btw great howto, got it up and running without a sweat.
QuoteApril 14th, 2007 at 10:44 am
cpanel defaults to having a “public_html” folder and also a link to public_html named “www”
so.. to change it to just / you do
cd $
mv public_html public_html2
ln -s ../test/public public_html
and you are done.
cheers
QuoteApril 14th, 2007 at 10:45 am
that should have read
Quotecd ~ not “cd $”