27
Nov
08

rails + apache 2.2 on ubuntu/debian

Rails is sort of the flavor of the moment in rapid development frameworks, a well deserved status. Neat looking, versatile, and easy to learn (at least the basics ;P), something you should try at least once.

One of my prospect customers asked me if I could set up a RoR capable server for him, after some research this is what I came up with.

My distro of choice is ubuntu/debian, mainly cause that’s what I use to run this server.

First you need to install all the ruby goodies.

sudo apt-get install ruby rdoc irb libyaml-ruby libzlib-ruby \
 ri libopenssl-ruby

Ruby has its own package manager, which tends to work better than apt-get dependency wise. It’s called RubyGems, and you can grab it at rubyforge.org.

wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz
tar zxvf rubygems-1.3.1.tgz
cd rubygems-1.3.1
sudo ruby setup.rb

after it’s installed, you want to create a link to your executable and install rails using the gem tool.

sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
sudo gem update --system
sudo gem install rails

Now you need to make a decision, mongrel or apache as the web server. I chose to stick with apache due to personal preference (more homogeneous environment to administer).

sudo gem install passenger
sudo apt-get install apache2 apache2-prefork-dev
sudo passenger-install-apache2-module

add this to your apache config (your versions may change, just grab the output from the passenger installer you’ve just executed).

   LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/ext/apache2/mod_passenger.so
   PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3
   PassengerRuby /usr/bin/ruby1.8

and you’re good to go, don’t need to do any extra configuring, just your every day apache vhost mumbo jumbo.

However if you wanted to install mongrel instead:

sudo apt-get install build-essential ruby1.8-dev
sudo gem install mongrel

How well mongrel works, and what config does it need, I don’t know.

You will need some sort of database, SQLite or MySQL are good choices depending on the size of your project. SQLite is more of a get-me-started-quick-i-don’t-care-about-all-the-database-nonsense database, while MySQL will let you scale better, adapt and offer you different storage engines depending on your needs (transactional, clustered, memory only, archive, etc).


0 Responses to “rails + apache 2.2 on ubuntu/debian”


  1. No Comments

Leave a Reply