Next I tried the opposite approach. Converting an existing LAPP iso into LAPR. I am more familiar with installing Rails on Ubuntu than installing PG. That went much smoother, after, of course gnashing my teeth on the previous install.
Turnkey makes some nice appliances for testing things out and for deployments. They have a Rails stack, a LAMP and the aforementioned LAPP stack. (They also have a Django Python one I'm dying to try out). They are based on Ubuntu and seem somewhat affiliated with them. They seem to all use Hardy because that is the latest LTS release. There is also a way to deploy your app in the 'cloud". For some appliance vendors this means an Amazon EC2 instance. For Turnkey, they are using VPS.NET (see the site for details).
What I like about Turnkey appliances is they are distributed as (Live/Installable) .isos and not pre-built vdks or other VM images. They will work anywhere even burned to a CD and booted from there. They also offer a Core appliance where you can build your own and utilize the web based interface they've built.
Once installed or booted from the Live CD, you point your web browser at the provided IP address or SSH into it. (using the root password you set up during the install). From there you apt-get install away! Now, Turnkey keeps their appliances up-to date daily with security updates, but not with application updates. I had to apt-get update and then apt-get upgrade. On my LAPP instance, this seemed to update PostrgeSQL to 8.3.8.
As I am wont to do, I installed Ruby and Rails using the tried and true method outlined on the Download page for Rails . This involves compiling from source. To do this on Ubunt, see my earlier Post: Ruby with readline on Ubuntu .
Once you have Rails installed, you need to install the sqlite3-ruby gem before testing it out, as Rails is configured to use Sqlite3 out of the box. But to install it, you have to first install Sqlite3 and its development library.
At this point, create a Rails app and start the Webrick server. Point your browser at the ip address
sudo apt-get install sqlite3 libsqlite3-dev sudo gem install sqlite3-rub
Next, set up a model using the scaffold generator:
./script/generate scaffold Post name:sting comment:text rake db:migrate
Going to ip address
:3000/posts should show the empty posts model you just created. Now, on to installing Postgres support:
The correct gem to install is 'pg', no matter what you may have heard. Next setup config/database.yml:
sudo apt-get install libpq-dev sudo gem install pg
production: adapter: postgresql database: app username: postgres encoding: utf8 pool: 5 timeout: 5000Turnkey LAPP ships with the postgres user having no password. Also, Postgres defaults to US-ASCII encoding, but Ruby expects UTF-8. (Ruby 1.9 lets you specify different encodings).
Finally, do another:
rake RAILS_ENV=production db:create db:migrate # close and restart the server in production mode: ./script/server -e production
Now, enter any posts in your web browser, and they should show up in the phpPgAdmin screen.
You have successfully created a LAPR appliance. Go collect your fame and fortune!