PostgreSQL Installation in Ubuntu

It has been a while since I last use PostgreSQL professionally and I really miss it a lot. The newly 9.1 installation really brings back all the memories and it's quite sad that I can't remember how to use psql anymore. To make the situation worse, I am now stuck with the horrors, stupidity, and the numerous WTF of maintaining old legacy applications developed using The Shitty Toy Db (TSTD)* with no referential integrity. All this crap using this TSTD makes me long for PostgreSQL even more.

* To be fair to TSTD, if you configure it correctly, is not that bad.

Step 1 : Installation
$ sudo add-apt-repository ppa:pitti/postgresql
$ sudo apt-get update

$ sudo apt-cache search postgresql-9.1 
postgresql-9.1 - object-relational SQL database, version 9.1 server
postgresql-9.1-dbg - debug symbols for postgresql-9.1
postgresql-client-9.1 - front-end programs for PostgreSQL 9.1
postgresql-contrib-9.1 - additional facilities for PostgreSQL

$ sudo apt-get install postgresql-9.1 postgresql-9.1-dbg postgresql-client-9.1 postgresql-contrib-9.1

Step 2 : Setting up your own database account
$ echo $USER
foobar

$ sudo -u postgres createuser --superuser $USER

$ sudo -u postgres psql 
postgres=# \password foobar
Enter new password: 
Enter it again: 
postgres=# \q

$ createdb $USER
$ psql

Step 3 : Have fun.
Step 4 : Profit ?!

No comments:

Post a Comment