Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
add comment

3 Answers

up vote 18 down vote accepted

The simplest way to do this is 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 (depending on the list of packages installed, of course)

share|improve this answer
    
All right, I will try later, for now, thank you very much! –  B4NZ41 Mar 30 '11 at 20:26
1  
I run the command line --> sudo apt-get --purge remove postgresql and looks like it was removed from my ubuntu.. I'm waiting the update, always on update postgres show up the error. thanks anyway. –  B4NZ41 Apr 8 '11 at 23:34
    
I thought it was right. But today I got the same warning again, a crash system, something try to update the postgres, but it not happen, then the crash report has showed itself.. some suggestions? thanks again. –  B4NZ41 Apr 12 '11 at 18:00
1  
It should be dpkg -l | grep postgres –  Mithun P Mar 8 '12 at 13:53
    
Thanks, @MithunP for catching that. Corrected. –  Code Friendly Apr 20 '12 at 15:14
add comment

Steps that worked for me on Ubuntu 8.04.2 to remove postgres 8.3

  1. List All Postgres related packages

    dpkg -l | grep postgres
    
    ii  postgresql                            8.3.17-0ubuntu0.8.04.1           object-relational SQL database (latest versi
    ii  postgresql-8.3                        8.3.9-0ubuntu8.04                object-relational SQL database, version 8.3
    ii  postgresql-client                     8.3.9-0ubuntu8.04                front-end programs for PostgreSQL (latest ve
    ii  postgresql-client-8.3                 8.3.9-0ubuntu8.04                front-end programs for PostgreSQL 8.3
    ii  postgresql-client-common              87ubuntu2                        manager for multiple PostgreSQL client versi
    ii  postgresql-common                     87ubuntu2                        PostgreSQL database-cluster manager
    ii  postgresql-contrib                    8.3.9-0ubuntu8.04                additional facilities for PostgreSQL (latest
    ii  postgresql-contrib-8.3                8.3.9-0ubuntu8.04                additional facilities for PostgreSQL
    
  2. Remove all above listed

    sudo apt-get --purge remove postgresql postgresql-8.3  postgresql-client  postgresql-client-8.3 postgresql-client-common postgresql-common  postgresql-contrib postgresql-contrib-8.3
    
  3. Remove the following folders

    sudo rm -rf /var/lib/postgresql/
    sudo rm -rf /var/log/postgresql/
    sudo rm -rf /etc/postgresql/
    
share|improve this answer
    
Thanks! but I'm not using ubuntu anymore. Now I'm on opensuse and centos. Thanks anyway, if I have troubles again with postgres your answer will be useful. –  B4NZ41 Mar 8 '12 at 16:22
add comment

One command to completely remove postgresql in terminal is sudo apt-get --purge remove postgresql\*. Please note that this command will remove postgresql and all it's compenents.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.