To install RubyOnRails on Ubuntu ( Linux )
you need
- Apache or lighttpd
Apache Installation
sudo apt-get install ruby-full build-essential apache2 apache2-mpm-prefork apache2-prefork-devThe link below is to a specific version of rubygems. You can get a later version from http://rubyforge.org/frs/?group_id=126, but it's not really necessary because we ask rubygems to update itself at the end.
I've encountered a problem with RubyGems 1.1 that was only resolved by following the link above and installing 1.2 version. sudo gem update --system did not solve it prior to that. I'd recommend to follow the link above for a smoother installation.
wget http://rubyforge.org/frs/download.php/34638/rubygems-1.1.0.tgz
tar xzvf rubygems-1.1.0.tgz
cd rubygems-1.1.0
sudo ruby setup.rb
sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
sudo gem update --system
sudo gem install rails
sudo gem install passenger
sudo passenger-install-apache2-module
Add these lines to /etc/apache2/apache2.conf (Actually, you should probably put them in /etc/apache2/httpd.conf ... that's meant for overriding the apache2.conf file and is automatically included by the default apache2.conf):
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-1.0.3/ext/apache2/mod_passenger.so
RailsSpawnServer /usr/lib/ruby/gems/1.8/gems/passenger-1.0.3/bin/passenger-spawn-server
RailsRuby /usr/bin/ruby1.8
Create something like this in /etc/apache2/sites-available/ror.myhost.com
ServerName ror.myhost.com
DocumentRoot /home/myuser/www/mynewapp/public
sudo a2enmod rewrite
sudo a2ensite ror.myhost.com
sudo /etc/init.d/apache2 restart
maybe also do..
rails mynewapp
Lighttpd Installation
Preparing the house:
sudo apt-get install ruby-full build-essential lighttpd libfcgi-ruby1.8
just after everything is done:
sudo gem install rails
and now... lets get hacking, prepare your favorite editor (i'll use kate... but you can choose gedit, kate, nano, use vi or some other only if you know how to use them...)
open a shell, and browse to the directory you want to use (i am using /home/santiago/proyectos/, for your application, i will name it beholder and write the following:
rails beholder
you will see a bunch of stuff on the shell... that should be fine (unless you see a error message). that created the rails folder with all the stuff, so now i have: /home/santiago/proyectos/beholder/public/beholder
now you need to tell lighttpd _how_ to handle that, so you can work with rails, now do this:
sudo kate /etc/lighttpd/lighttpd.conf
and here starts the tricky part, paste at the end of the file:
server.modules += ( "mod_fastcgi", "mod_rewrite" )
$HTTP["host"] == "localhost" {
server.document-root = "/home/santiago/proyectos/beholder/public/"
server.error-handler-404 = "/dispatch.fcgi"
fastcgi.server = ( ".fcgi" => ( "localhost" => (
"min-procs" => 1,
"max-procs" => 1,
"socket" => "/tmp/ruby-beholder.socket",
"bin-path" => "/home/santiago/proyectos/beholder/public/dispatch.fcgi",
"bin-environment" => ( "RAILS_ENV" => "development" )
) ) )
}
now run
sudo /etc/init.d/lighttpd restartand you're set, go to http://localhost and you should see the rails index... click on the link "About your rails enviroment" and if you dont see a 404 o 500 error... then your're set (you should see either a rails error, or a rails message or something like that)

0 comments:
Post a Comment