I just finished a fresh install of Ubuntu Server and selected the LAMP package by default.
Tested it and it's working great with PHP scripts, but now I want to be able to run RubyOnRails on the same Apache install.
How can I accomplish this through the CLI?
Thanks a lot!
I would definitely use Passenger for this. It's easy to set up and run, and performs well. Passenger takes care of spawning and killing child Rails processes to handle incoming requests.
The passenger module supplied by Ubuntu is ok, but slightly behind. A more recent package is available by installing from the semi-official repository. According to Passenger's install page:
Add the following line to the Third Party Software Sources:
deb http://apt.brightbox.net lucid main
(The simplest way to do that is to create a file in /etc/apt/sources.list.d/ containing the deb instruction, and then run 'apt-get update').
Once you've done this then you can install Phusion Passenger by running:
apt-get install libapache2-mod-passenger
I think the installer automatically enables the module and restarts Apache, but if not you should do that yourself.
Check the manual on how to deploy a Rails app, but you'll find it remarkably easy:
I would also advise you to look at running Ruby Enterprise Edition (ree) which is a modified Ruby interpreter, built by the same team as Passenger, that features reduced memory usage by about 33%. It's well tested and 100% compatible with Ruby 1.8.7. You'll find many people running it on production servers.
You need use the passenger gem or you can use mod_proxy to do a proxy to your backend in Rails. In this cas you can run Rails with thin or unicorn.
Rails on Ubuntu as a Standalone HTTP server
Surprisingly there are not a lot of good looking HOWTOs on this.
Among the list that shows up on Google probably only the top item is good: http://www.google.com/search?q=rails+on+ubuntu+10.10
Other items deal with RVM - I haven't used it and it seems unnecessarily if you have Gems.
With Apache
If you need it to run through Apache then you need to use Passenger - when you click on Install Passenger Now there is a nice HOWTO for setting up Apache mod_rails via Gems.
The official Rails deployment page lists Passenger as their first option (aka mod_rails): http://rubyonrails.org/deploy