How to thoroughly purge and reinstall postgresql on ubuntu?

Posted by John Mee on Stack Overflow See other posts from Stack Overflow or by John Mee
Published on 2010-05-01T02:07:08Z Indexed on 2010/05/01 2:17 UTC
Read the original article Hit count: 371

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about postgresql

Related posts about ubuntu