How to remove Postgres from my installation?











up vote
59
down vote

favorite
35












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




























    up vote
    59
    down vote

    favorite
    35












    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


























      up vote
      59
      down vote

      favorite
      35









      up vote
      59
      down vote

      favorite
      35






      35





      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















      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.







      command-line 9.10 postgresql






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 31 '11 at 0:39









      Jorge Castro

      35.7k105422617




      35.7k105422617










      asked Mar 30 '11 at 20:03









      B4NZ41

      4291613




      4291613






















          5 Answers
          5






          active

          oldest

          votes

















          up vote
          105
          down vote



          accepted










          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.






          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






          • 2




            It should be dpkg -l | grep postgres
            – Mithun Sreedharan
            Mar 8 '12 at 13:53


















          up vote
          60
          down vote













          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






          • 1




            Step 3 can be combined into one line if using bash shell sudo rm -rf {/var/{lib,log},etc}/postgresql/
            – smac89
            Oct 5 '17 at 16:22










          • +1 for step 3 here. That was key for me. Tried removing the packages several times but there was cruft left behind in /var/lib/postgresql and /etc/postgresql that was causing subsequent operations after reinstall to fail.
            – Gil Hamilton
            Jan 29 at 23:14


















          up vote
          17
          down vote













          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

















          • 5




            I used sudo apt-get purge postgresql* on 14.04
            – Antonios Hadjigeorgalis
            Aug 6 '16 at 22:39




















          up vote
          0
          down vote













          Thanks to Code Friendly, & I want to share how I solved my problem.



          When I updated postgresql from the Synaptic application, it is the postgresql 10 version that was installed. So I had two versions of postgresql (10 & 9.6) installed in my debian machine. Postgresql 9.6 listening on port 5432. Postgresql 10 listening on port 5433 instead of 5432.



          When I run the comand msfconsole in a terminal, although metasploit connects to the msf database on port 5432, the following error message appears:





          root@kali:~# msfconsole
          [-] Failed to connect to the database: could not connect to server: Connection refused
          Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432?




          I unistall the 9.6 postgresql version from the Synaptic application, but the problem persists (postgresql 9.6 no longer appears in synaptic's installed software list);



          But by executing the command that follows we see that the version postgresql 9.6 was not completely unistalled:





          root@kali:~# dpkg -l | grep postgresql 
          ii postgresql 10+187 all object-relational SQL database (supported version)
          ii postgresql-9.6 ** all object-relational SQL database, version 9.6 server
          ii postgresql-10 10.0-1+b1 amd64 object-relational SQL database, version 10 server
          ii postgresql-client-10 10.0-1+b1 amd64 front-end programs for PostgreSQL 10
          ii postgresql-client-common 187 all manager for multiple PostgreSQL client versions
          ii postgresql-common 187 all PostgreSQL database cluster manager
          ii postgresql-contrib 10+187 all additional facilities for PostgreSQL (supported version)




          With the following command, postgresql-9.6 uninstalled completely:
          root@kali:~# sudo apt-get --purge remove postgresql-9.6



          Then I edited the file /etc/postgresql/10/main/postgresql.conf, changed the port number to 5432 and the problem is solved.





          Another error message appears:



          Creating initial database schema /usr/local/bin/bundle:22:in ``load': cannot load such file -- /usr/lib/ruby/exe/bundle (LoadError)     from /usr/local/bin/bundle:22:in `<main>


          I found that the cause was that two (2) versions of Ruby are installed in my debian machine, versions (2.2 & 2.3).



          Same thing, I uninstall the ruby 2.2 version from the synaptic application and the problem is solved, metasploit starts without problems.






          share|improve this answer






























            up vote
            0
            down vote













            Follow the commands:




            • sudo apt-get --purge remove postgresql


            List all postgres related packages:




            • dpkg -l | grep postgres


            remove all the above listed packages using the command :




            • apt-get --purge remove package1 package2 ..


            Confirm all the files and folders related to postgres/postgresql are deleted using the command :




            • whereis postgres

            • whereis postgresql


            Remove all the files and folders listed using rm command.



            Delete the user postgres using the command :




            • userdel -f postgres


            happy coding :)






            share|improve this answer








            New contributor




            T.Tijo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.


















              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "89"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f32730%2fhow-to-remove-postgres-from-my-installation%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              5 Answers
              5






              active

              oldest

              votes








              5 Answers
              5






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              105
              down vote



              accepted










              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.






              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






              • 2




                It should be dpkg -l | grep postgres
                – Mithun Sreedharan
                Mar 8 '12 at 13:53















              up vote
              105
              down vote



              accepted










              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.






              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






              • 2




                It should be dpkg -l | grep postgres
                – Mithun Sreedharan
                Mar 8 '12 at 13:53













              up vote
              105
              down vote



              accepted







              up vote
              105
              down vote



              accepted






              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.






              share|improve this 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.







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited May 9 at 16:44

























              answered Mar 30 '11 at 20:21









              Code Friendly

              1,77411212




              1,77411212












              • 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






              • 2




                It should be dpkg -l | grep postgres
                – Mithun Sreedharan
                Mar 8 '12 at 13:53


















              • 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






              • 2




                It should be dpkg -l | grep postgres
                – Mithun Sreedharan
                Mar 8 '12 at 13:53
















              All right, I will try later, for now, thank you very much!
              – B4NZ41
              Mar 30 '11 at 20:26




              All right, I will try later, for now, thank you very much!
              – B4NZ41
              Mar 30 '11 at 20:26




              1




              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 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




              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




              2




              2




              It should be dpkg -l | grep postgres
              – Mithun Sreedharan
              Mar 8 '12 at 13:53




              It should be dpkg -l | grep postgres
              – Mithun Sreedharan
              Mar 8 '12 at 13:53












              up vote
              60
              down vote













              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






              • 1




                Step 3 can be combined into one line if using bash shell sudo rm -rf {/var/{lib,log},etc}/postgresql/
                – smac89
                Oct 5 '17 at 16:22










              • +1 for step 3 here. That was key for me. Tried removing the packages several times but there was cruft left behind in /var/lib/postgresql and /etc/postgresql that was causing subsequent operations after reinstall to fail.
                – Gil Hamilton
                Jan 29 at 23:14















              up vote
              60
              down vote













              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






              • 1




                Step 3 can be combined into one line if using bash shell sudo rm -rf {/var/{lib,log},etc}/postgresql/
                – smac89
                Oct 5 '17 at 16:22










              • +1 for step 3 here. That was key for me. Tried removing the packages several times but there was cruft left behind in /var/lib/postgresql and /etc/postgresql that was causing subsequent operations after reinstall to fail.
                – Gil Hamilton
                Jan 29 at 23:14













              up vote
              60
              down vote










              up vote
              60
              down vote









              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












              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












              share|improve this answer



              share|improve this answer










              answered Mar 8 '12 at 14:31









              Mithun Sreedharan

              1,56721620




              1,56721620












              • 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






              • 1




                Step 3 can be combined into one line if using bash shell sudo rm -rf {/var/{lib,log},etc}/postgresql/
                – smac89
                Oct 5 '17 at 16:22










              • +1 for step 3 here. That was key for me. Tried removing the packages several times but there was cruft left behind in /var/lib/postgresql and /etc/postgresql that was causing subsequent operations after reinstall to fail.
                – Gil Hamilton
                Jan 29 at 23:14


















              • 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






              • 1




                Step 3 can be combined into one line if using bash shell sudo rm -rf {/var/{lib,log},etc}/postgresql/
                – smac89
                Oct 5 '17 at 16:22










              • +1 for step 3 here. That was key for me. Tried removing the packages several times but there was cruft left behind in /var/lib/postgresql and /etc/postgresql that was causing subsequent operations after reinstall to fail.
                – Gil Hamilton
                Jan 29 at 23:14
















              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




              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




              1




              1




              Step 3 can be combined into one line if using bash shell sudo rm -rf {/var/{lib,log},etc}/postgresql/
              – smac89
              Oct 5 '17 at 16:22




              Step 3 can be combined into one line if using bash shell sudo rm -rf {/var/{lib,log},etc}/postgresql/
              – smac89
              Oct 5 '17 at 16:22












              +1 for step 3 here. That was key for me. Tried removing the packages several times but there was cruft left behind in /var/lib/postgresql and /etc/postgresql that was causing subsequent operations after reinstall to fail.
              – Gil Hamilton
              Jan 29 at 23:14




              +1 for step 3 here. That was key for me. Tried removing the packages several times but there was cruft left behind in /var/lib/postgresql and /etc/postgresql that was causing subsequent operations after reinstall to fail.
              – Gil Hamilton
              Jan 29 at 23:14










              up vote
              17
              down vote













              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

















              • 5




                I used sudo apt-get purge postgresql* on 14.04
                – Antonios Hadjigeorgalis
                Aug 6 '16 at 22:39

















              up vote
              17
              down vote













              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

















              • 5




                I used sudo apt-get purge postgresql* on 14.04
                – Antonios Hadjigeorgalis
                Aug 6 '16 at 22:39















              up vote
              17
              down vote










              up vote
              17
              down vote









              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












              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












              share|improve this answer



              share|improve this answer










              answered Feb 12 '14 at 6:02









              user3146785

              17113




              17113








              • 5




                I used sudo apt-get purge postgresql* on 14.04
                – Antonios Hadjigeorgalis
                Aug 6 '16 at 22:39
















              • 5




                I used sudo apt-get purge postgresql* on 14.04
                – Antonios Hadjigeorgalis
                Aug 6 '16 at 22:39










              5




              5




              I used sudo apt-get purge postgresql* on 14.04
              – Antonios Hadjigeorgalis
              Aug 6 '16 at 22:39






              I used sudo apt-get purge postgresql* on 14.04
              – Antonios Hadjigeorgalis
              Aug 6 '16 at 22:39












              up vote
              0
              down vote













              Thanks to Code Friendly, & I want to share how I solved my problem.



              When I updated postgresql from the Synaptic application, it is the postgresql 10 version that was installed. So I had two versions of postgresql (10 & 9.6) installed in my debian machine. Postgresql 9.6 listening on port 5432. Postgresql 10 listening on port 5433 instead of 5432.



              When I run the comand msfconsole in a terminal, although metasploit connects to the msf database on port 5432, the following error message appears:





              root@kali:~# msfconsole
              [-] Failed to connect to the database: could not connect to server: Connection refused
              Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432?




              I unistall the 9.6 postgresql version from the Synaptic application, but the problem persists (postgresql 9.6 no longer appears in synaptic's installed software list);



              But by executing the command that follows we see that the version postgresql 9.6 was not completely unistalled:





              root@kali:~# dpkg -l | grep postgresql 
              ii postgresql 10+187 all object-relational SQL database (supported version)
              ii postgresql-9.6 ** all object-relational SQL database, version 9.6 server
              ii postgresql-10 10.0-1+b1 amd64 object-relational SQL database, version 10 server
              ii postgresql-client-10 10.0-1+b1 amd64 front-end programs for PostgreSQL 10
              ii postgresql-client-common 187 all manager for multiple PostgreSQL client versions
              ii postgresql-common 187 all PostgreSQL database cluster manager
              ii postgresql-contrib 10+187 all additional facilities for PostgreSQL (supported version)




              With the following command, postgresql-9.6 uninstalled completely:
              root@kali:~# sudo apt-get --purge remove postgresql-9.6



              Then I edited the file /etc/postgresql/10/main/postgresql.conf, changed the port number to 5432 and the problem is solved.





              Another error message appears:



              Creating initial database schema /usr/local/bin/bundle:22:in ``load': cannot load such file -- /usr/lib/ruby/exe/bundle (LoadError)     from /usr/local/bin/bundle:22:in `<main>


              I found that the cause was that two (2) versions of Ruby are installed in my debian machine, versions (2.2 & 2.3).



              Same thing, I uninstall the ruby 2.2 version from the synaptic application and the problem is solved, metasploit starts without problems.






              share|improve this answer



























                up vote
                0
                down vote













                Thanks to Code Friendly, & I want to share how I solved my problem.



                When I updated postgresql from the Synaptic application, it is the postgresql 10 version that was installed. So I had two versions of postgresql (10 & 9.6) installed in my debian machine. Postgresql 9.6 listening on port 5432. Postgresql 10 listening on port 5433 instead of 5432.



                When I run the comand msfconsole in a terminal, although metasploit connects to the msf database on port 5432, the following error message appears:





                root@kali:~# msfconsole
                [-] Failed to connect to the database: could not connect to server: Connection refused
                Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432?




                I unistall the 9.6 postgresql version from the Synaptic application, but the problem persists (postgresql 9.6 no longer appears in synaptic's installed software list);



                But by executing the command that follows we see that the version postgresql 9.6 was not completely unistalled:





                root@kali:~# dpkg -l | grep postgresql 
                ii postgresql 10+187 all object-relational SQL database (supported version)
                ii postgresql-9.6 ** all object-relational SQL database, version 9.6 server
                ii postgresql-10 10.0-1+b1 amd64 object-relational SQL database, version 10 server
                ii postgresql-client-10 10.0-1+b1 amd64 front-end programs for PostgreSQL 10
                ii postgresql-client-common 187 all manager for multiple PostgreSQL client versions
                ii postgresql-common 187 all PostgreSQL database cluster manager
                ii postgresql-contrib 10+187 all additional facilities for PostgreSQL (supported version)




                With the following command, postgresql-9.6 uninstalled completely:
                root@kali:~# sudo apt-get --purge remove postgresql-9.6



                Then I edited the file /etc/postgresql/10/main/postgresql.conf, changed the port number to 5432 and the problem is solved.





                Another error message appears:



                Creating initial database schema /usr/local/bin/bundle:22:in ``load': cannot load such file -- /usr/lib/ruby/exe/bundle (LoadError)     from /usr/local/bin/bundle:22:in `<main>


                I found that the cause was that two (2) versions of Ruby are installed in my debian machine, versions (2.2 & 2.3).



                Same thing, I uninstall the ruby 2.2 version from the synaptic application and the problem is solved, metasploit starts without problems.






                share|improve this answer

























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  Thanks to Code Friendly, & I want to share how I solved my problem.



                  When I updated postgresql from the Synaptic application, it is the postgresql 10 version that was installed. So I had two versions of postgresql (10 & 9.6) installed in my debian machine. Postgresql 9.6 listening on port 5432. Postgresql 10 listening on port 5433 instead of 5432.



                  When I run the comand msfconsole in a terminal, although metasploit connects to the msf database on port 5432, the following error message appears:





                  root@kali:~# msfconsole
                  [-] Failed to connect to the database: could not connect to server: Connection refused
                  Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432?




                  I unistall the 9.6 postgresql version from the Synaptic application, but the problem persists (postgresql 9.6 no longer appears in synaptic's installed software list);



                  But by executing the command that follows we see that the version postgresql 9.6 was not completely unistalled:





                  root@kali:~# dpkg -l | grep postgresql 
                  ii postgresql 10+187 all object-relational SQL database (supported version)
                  ii postgresql-9.6 ** all object-relational SQL database, version 9.6 server
                  ii postgresql-10 10.0-1+b1 amd64 object-relational SQL database, version 10 server
                  ii postgresql-client-10 10.0-1+b1 amd64 front-end programs for PostgreSQL 10
                  ii postgresql-client-common 187 all manager for multiple PostgreSQL client versions
                  ii postgresql-common 187 all PostgreSQL database cluster manager
                  ii postgresql-contrib 10+187 all additional facilities for PostgreSQL (supported version)




                  With the following command, postgresql-9.6 uninstalled completely:
                  root@kali:~# sudo apt-get --purge remove postgresql-9.6



                  Then I edited the file /etc/postgresql/10/main/postgresql.conf, changed the port number to 5432 and the problem is solved.





                  Another error message appears:



                  Creating initial database schema /usr/local/bin/bundle:22:in ``load': cannot load such file -- /usr/lib/ruby/exe/bundle (LoadError)     from /usr/local/bin/bundle:22:in `<main>


                  I found that the cause was that two (2) versions of Ruby are installed in my debian machine, versions (2.2 & 2.3).



                  Same thing, I uninstall the ruby 2.2 version from the synaptic application and the problem is solved, metasploit starts without problems.






                  share|improve this answer














                  Thanks to Code Friendly, & I want to share how I solved my problem.



                  When I updated postgresql from the Synaptic application, it is the postgresql 10 version that was installed. So I had two versions of postgresql (10 & 9.6) installed in my debian machine. Postgresql 9.6 listening on port 5432. Postgresql 10 listening on port 5433 instead of 5432.



                  When I run the comand msfconsole in a terminal, although metasploit connects to the msf database on port 5432, the following error message appears:





                  root@kali:~# msfconsole
                  [-] Failed to connect to the database: could not connect to server: Connection refused
                  Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432?




                  I unistall the 9.6 postgresql version from the Synaptic application, but the problem persists (postgresql 9.6 no longer appears in synaptic's installed software list);



                  But by executing the command that follows we see that the version postgresql 9.6 was not completely unistalled:





                  root@kali:~# dpkg -l | grep postgresql 
                  ii postgresql 10+187 all object-relational SQL database (supported version)
                  ii postgresql-9.6 ** all object-relational SQL database, version 9.6 server
                  ii postgresql-10 10.0-1+b1 amd64 object-relational SQL database, version 10 server
                  ii postgresql-client-10 10.0-1+b1 amd64 front-end programs for PostgreSQL 10
                  ii postgresql-client-common 187 all manager for multiple PostgreSQL client versions
                  ii postgresql-common 187 all PostgreSQL database cluster manager
                  ii postgresql-contrib 10+187 all additional facilities for PostgreSQL (supported version)




                  With the following command, postgresql-9.6 uninstalled completely:
                  root@kali:~# sudo apt-get --purge remove postgresql-9.6



                  Then I edited the file /etc/postgresql/10/main/postgresql.conf, changed the port number to 5432 and the problem is solved.





                  Another error message appears:



                  Creating initial database schema /usr/local/bin/bundle:22:in ``load': cannot load such file -- /usr/lib/ruby/exe/bundle (LoadError)     from /usr/local/bin/bundle:22:in `<main>


                  I found that the cause was that two (2) versions of Ruby are installed in my debian machine, versions (2.2 & 2.3).



                  Same thing, I uninstall the ruby 2.2 version from the synaptic application and the problem is solved, metasploit starts without problems.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 2 '17 at 0:33









                  J. Starnes

                  1,411416




                  1,411416










                  answered Nov 1 '17 at 23:03









                  Internaut 06

                  1




                  1






















                      up vote
                      0
                      down vote













                      Follow the commands:




                      • sudo apt-get --purge remove postgresql


                      List all postgres related packages:




                      • dpkg -l | grep postgres


                      remove all the above listed packages using the command :




                      • apt-get --purge remove package1 package2 ..


                      Confirm all the files and folders related to postgres/postgresql are deleted using the command :




                      • whereis postgres

                      • whereis postgresql


                      Remove all the files and folders listed using rm command.



                      Delete the user postgres using the command :




                      • userdel -f postgres


                      happy coding :)






                      share|improve this answer








                      New contributor




                      T.Tijo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                      Check out our Code of Conduct.






















                        up vote
                        0
                        down vote













                        Follow the commands:




                        • sudo apt-get --purge remove postgresql


                        List all postgres related packages:




                        • dpkg -l | grep postgres


                        remove all the above listed packages using the command :




                        • apt-get --purge remove package1 package2 ..


                        Confirm all the files and folders related to postgres/postgresql are deleted using the command :




                        • whereis postgres

                        • whereis postgresql


                        Remove all the files and folders listed using rm command.



                        Delete the user postgres using the command :




                        • userdel -f postgres


                        happy coding :)






                        share|improve this answer








                        New contributor




                        T.Tijo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.




















                          up vote
                          0
                          down vote










                          up vote
                          0
                          down vote









                          Follow the commands:




                          • sudo apt-get --purge remove postgresql


                          List all postgres related packages:




                          • dpkg -l | grep postgres


                          remove all the above listed packages using the command :




                          • apt-get --purge remove package1 package2 ..


                          Confirm all the files and folders related to postgres/postgresql are deleted using the command :




                          • whereis postgres

                          • whereis postgresql


                          Remove all the files and folders listed using rm command.



                          Delete the user postgres using the command :




                          • userdel -f postgres


                          happy coding :)






                          share|improve this answer








                          New contributor




                          T.Tijo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.









                          Follow the commands:




                          • sudo apt-get --purge remove postgresql


                          List all postgres related packages:




                          • dpkg -l | grep postgres


                          remove all the above listed packages using the command :




                          • apt-get --purge remove package1 package2 ..


                          Confirm all the files and folders related to postgres/postgresql are deleted using the command :




                          • whereis postgres

                          • whereis postgresql


                          Remove all the files and folders listed using rm command.



                          Delete the user postgres using the command :




                          • userdel -f postgres


                          happy coding :)







                          share|improve this answer








                          New contributor




                          T.Tijo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.









                          share|improve this answer



                          share|improve this answer






                          New contributor




                          T.Tijo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.









                          answered Dec 4 at 4:10









                          T.Tijo

                          1




                          1




                          New contributor




                          T.Tijo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.





                          New contributor





                          T.Tijo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.






                          T.Tijo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Ask Ubuntu!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.





                              Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                              Please pay close attention to the following guidance:


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f32730%2fhow-to-remove-postgres-from-my-installation%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              How did Captain America manage to do this?

                              迪纳利

                              南乌拉尔铁路局