PostgreSQL – How to Remove Postgres from My Installation

command linepostgresql

I have ubuntu 9.10(karmic), and when I attempted to install a new program, the postgres was installed as a dependency of that program, no problem at all if the installation occurs with success, but there was an error, and the Postgres was not installed and the application is not working. I had tryed to update the Postgres and nothing, only the message "there was an error and your postgres can not be installed"

Now I want to remove completely the Postgres from my machine, how can I do that, I do not want to kill the process every boot. I just want to remove Postgres.

What is the command line?

Thanks people.

Best Answer

The simplest way to do this is to open a terminal and type:

sudo apt-get --purge remove postgresql

This will also prompt you to remove that software that depends on Postgres, which in this case it appears you would like to do.
I do not personally run 9.10 or Postgres, so it is possible that Postgres installs itself in several parts. In that case, a simple:

dpkg -l | grep postgres

Will get you the list of those packages that Postgres installed. Then, just use the same "apt-get --purge remove ...." command but instead of just postgresql, type each package name, separated by spaces, like:

sudo apt-get --purge remove postgresql postgresql-doc postgresql-common

This is dependent on the list of packages installed, of course.