Running Postgres for development on Oneiric

Created 18th October, 2011 03:27 (UTC), last edited 18th October, 2011 03:31 (UTC)

These are some notes for running Oneiric on a development machine.

Upgrading from Natty

Make sure all old Postgres installations are purged:

sudo apt-get purge postgresql postgresql-8.4

Getting Postgres 9.1 up and running

Install postgres:

sudo apt-get install postgresql

Only on a development machine

Turning off the fsync option will make Postgres run faster as it won't insist that all database changes are written to disk. Clearly do not do this if you care about the data you are writing to Postgres. This shouldn't be a problem on any development machine as they're all test databases.

Edit the server configuration:

sudo nano /etc/postgres/9.1/main/postgresql.conf

Change:

fsync = off

Then:

sudo service postgresql restart

Configure your ident authentication

Making proper use of ident authentication means that you can access Postgres without needing to use a password. Many of our Postgres set up scripts for projects assume that you have ident configured as a Postgres superuser.

Run psql as the postgres user to add in your configuration:

sudo -u postgres psql

And now we need to configure ident authentication — my user name is kirit, change to whatever you log in to Ubuntu as:

create role kirit login superuser;
create database kirit with owner=kirit;

Exit psql and try again with your own account:

psql

You should now be able to see the postgres prompt again.

I have a Django user that I use across projects:

create role "Django" login superuser password 'django';

From here you can set up the databases or add other roles that you need normally.


Categories: