Rails port/Ubuntu
The best way to install rails and rubygems is to NOT use the Ubuntu packages. This is because we need specific versions of certain things, including rails itself. Instead of using apt-get, we install rubygems from source and install rails alongside the other gems. Additionally, we can install passenger which lets us use Apache instead of WEBrick. Here are some installation notes.
Contents |
Dependancies
sudo apt-get install ruby1.8 rdoc1.8 ri1.8 ruby irb libxml2-dev libxslt1-dev ruby1.8-dev apache2-dev libmagick9-dev build-essential libopenssl-ruby subversion apache2 postgresql-8.3 postgresql-contrib
Note: on Ubuntu 8.04 server edition EBS image for EC2, use instead the following package names: replace apache2-dev with apache2-threaded-dev and rdoc1.8 with rdoc.
For Ubuntu 10.04 (Lucid) use the following list:
sudo apt-get install ruby rdoc ri irb libxml2-dev libxslt1-dev ruby-dev apache2-dev libmagick9-dev build-essential libopenssl-ruby subversion apache2 postgresql postgresql-contrib
For Ubuntu 10.10 use the following list:
sudo apt-get install ruby rdoc ri libxml2-dev libxslt1-dev ruby-dev apache2-threaded-dev libmagickwand-dev build-essential libruby subversion apache2 postgresql postgresql-contrib
For Ubuntu 11.04 (Natty) use the following list:
sudo apt-get install ruby rdoc ri libxml2-dev libxslt1-dev ruby-dev apache2-threaded-dev libmagickwand-dev build-essential libruby subversion apache2 postgresql postgresql-contrib
If you are working with a brand new Ubuntu installation, then you should install git:
sudo apt-get install git-core
Installing rubygems
wget http://files.rubyforge.vm.bytemark.co.uk/rubygems/rubygems-1.3.7.tgz tar -xzvf rubygems-1.3.7.tgz cd rubygems-1.3.7/ sudo ruby setup.rb sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
Back to main page
Now go back to the main Rails Port page, and install the required gems (including rails), run the tests and get things working with WEBrick (i.e. script/server). When that's working, you can try sorting out passenger, below.
Installing passenger
When you've got the site working, you might want to use Passenger, it's quite useful.
Package Install
Ubuntu 11.04 (Natty) already has a package for passenger.
sudo apt-get install libapache2-mod-passenger
For 10.04 (Lucid) there is a package available from Brightbox: Install guide
Manual Install
sudo gem install passenger sudo passenger-install-apache2-module
create a new file /etc/apache2/conf.d/passenger with the following contents (change to correct version of passenger):
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
If you just want to use the default VirtualHost for your rails_port app, change the docroot to point to the public/ folder, e.g.
DocumentRoot /home/osm/api06/public
RailsEnv development
The RailsEnv directive puts passenger into the development environment, which is the one you'll want to use for coding.