Tuesday, August 24, 2010

Uninstall EnterpriseDB version of PostgreSQL 9.0 beta

Having problems with EnterpriseDB version of PostgreSQL, I decided to uninstall it.

I could not find a documentation about uninstalling the software.
But I did find an executable file "uninstall-postgresql" in the following directory.
So I ran it.

$ ls /opt/PostgreSQL/9.0/
bin   doc      installer  pgAdmin3   scripts  stackbuilder
data  include  lib        pg_env.sh  share    uninstall-postgresql
$ sudo /opt/PostgreSQL/9.0/uninstall-postgresql

That started a GUI uninstaller. It gave me an warning at the end of the process, saying that /data directory and user postgres are not removed. That's fine. I will remove them manually.

$ ls /opt/PostgreSQL/9.0/
$ ls /opt/PostgreSQL/9.0/data
ls: Permission denied
$ sudo ls /opt/PostgreSQL/9.0/data
PG_VERSION  pg_hba.conf    pg_notify pg_twophase
base     pg_ident.conf  pg_stat_tmp pg_xlog
global     pg_log    pg_subtrans postgresql.conf
pg_clog     pg_multixact   pg_tblspc postmaster.opts
$ sudo rm -rf /opt/PostgreSQL/9.0/data
$ sudo ls /opt/PostgreSQL/9.0/data
ls: /opt/PostgreSQL/9.0/data: No such file or directory
$ sudo rm -rf /opt/PostgreSQL/
$ ls /opt/

Now remove the user:
$ finger postgres
Login: postgres          Name: PostgreSQL
Directory: /opt/PostgreSQL/9.0       Shell: /bin/sh
Never logged in.
No mail.
No Plan.
$ sudo userdel -r postgres
userdel: postgres home directory (/opt/PostgreSQL/9.0) not found
$ finger postgres
finger: postgres: no such user.