0

I have uninstall postgress sql from my machine with command:

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

but when I do sudo apt-get update, I still see postgress:

Hit:14 http://ppa.launchpad.net/elementary-os/stable/ubuntu bionic InRelease                                                                                            
Hit:15 http://apt.postgresql.org/pub/repos/apt bionic-pgdg InRelease <---                                                                                                   
Hit:16 http://ppa.launchpad.net/elementary-os/os-patches/ubuntu bionic InRelease 

How can I remove this and everything related to postgress?

2

You will need to remove the PostgreSQL source from your apt list. Fortunately, it's not too difficult to do via the Terminal. Here's how you do it:

  1. Open Terminal (if it's not already open)

  2. Change directories to /etc/apt/sources.list.d:

    cd /etc/apt/sources.list.d
    
  3. List the files in that directory:

    ll 
    

    You will see something like this:

    total 16
    drwxr-xr-x 2 root root 4096 Aug 24 13:19 ./
    drwxr-xr-x 7 root root 4096 Sep  9 13:00 ../
    -rw-r--r-- 1 root root  143 Aug 24 13:19 elementary.list
    -rw-r--r-- 1 root root  151 Aug 24 13:19 patches.list
    -rw-r--r-- 1 root root   62 Aug 24 14:18 postgres.list
    

    Note: The .list file for PostgreSQL may be different on your system, as it depends on how you installed the software.

  4. Now you have two options to choose from:

    1. Delete the PostgreSQL .list file:

      sudo rm -f postgres.list
      
    2. Comment out the repository contained in the .list file:

      sudo vi postgres.list
      

      Note: Feel free to use a different editor. The use of vi here is personal preference, not an explicit recommendation.

      When the file is open, add a # character to the start of every line. This will comment-out the repository.

  5. Update apt:

    sudo apt update 
    

Now you should see that the PostgreSQL repository is no longer part of the update collection.

1
  • this works!, I also remove pgadmin 4, to remove every postgres
    – Evan
    Sep 27 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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