views:

546

answers:

1

Somehow I've managed to completely bugger the install of postgresql on Ubuntu karmic. I want to start over from scratch, but when I "purge" the package with apt-get it still leaves traces behind such that the reinstall configuration doesn't run properly.

After I've done:

apt-get purge postgresql
apt-get install postgresql

It said

Setting up postgresql-8.4 (8.4.3-0ubuntu9.10.1) ...
Configuring already existing cluster (configuration: /etc/postgresql/8.4/main, data: /var/lib/postgresql/8.4/main, owner: 108:112)
Error: move_conffile: required configuration file     /var/lib/postgresql/8.4/main/postgresql.conf does not exist
Error: could not create default cluster. Please create it manually with

  pg_createcluster 8.4 main --start

or a similar command (see 'man pg_createcluster').
update-alternatives: using /usr/share/postgresql/8.4/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode.

Setting up postgresql (8.4.3-0ubuntu9.10.1) ...

I have a "/etc/postgresql" with nothing in it and "/etc/postgresql-common/" has a 'pg_upgradecluser.d' directory and root.crt and user_clusters files.

The /etc/passwd has a postgres user; the purge script doesn't appear to touch it. There's been a bunch of symptoms which I work through only to expose the next.

Right this second, when I run that command "pg_createcluster..." it complains that '/var/lib/postgresql/8.4/main/postgresql.conf does not exist', so I'll go find one of those but I'm sure that won't be the end of it.

Is there not some easy one-liner (or two) which will burn it completely and let me start over?

+2  A: 

Make sure postgres isn't running.

Go into dselect and search (/) for 'postgres' and purge ('_') all four postgres packages and also the dependancies that pop-up. Doing 'purge' via 'apt-get purge postgresql' doesn't purge any of the dependancies, so basically doesn't nothing since it is a meta package.

Then

rm -r /etc/postgresql/
rm -r /etc/postgresql-common/
rm -r /var/lib/postgresql/

Finally edit /etc/group and /etc/passwd and remove the postgres user and group manually.

Now re-install.

John Mee