Install PostgreSQL and the python driver for PostgreSQL
sudo apt-get install -y postgresql python-psycopg2
Setup PostgreSQL to listen on all interfaces by editing /etc/postgresql/9.1/main/postgresql.conf and uncommenting and modifying the relevant line. Look for the right file if you have a different version of PostgreSQL
listen_addresses = '*'
Restart PostgreSQL server to ensure that it starts listening on all interfaces.
sudo /etc/init.d/postgresql restart
