How To Remove PostgreSQL

Posted on by Justin Palmer | Updated:
Reading Time: 2 minutes

Sometimes during a software install, things can go sideways and you realize that not all the program downloaded or the installation was interrupted for some reason leaving you with incomplete files and empty directories. Honestly, this is a rare occurrence but it can happen from time to time. This then begs the question; So how do I completely uninstall recently installed software? In this tutorial, we’ll be safely removing PostgreSQL from our Liquid Web Ubuntu VPS server.  

How To Remove PostgreSQL
Note:
It’s essential to back up any databases you may need, do so before making deletions to your system.

Step 1: List the PostgreSQL Packages

Use the dpkg tool to list packages pertaining to the PostgreSQL setup.

dpkg -l | grep postgres

Output:

postgresql

Step 2: Delete the PostgreSQL Packages

In Step 1, all of the software packages related to the PostgreSQL install are shown. To remove and delete them all with one command, Start with this command.

apt-get --purge remove command

This is followed by each package name indicated separated with a space. For my particular version of PostgreSQL, the software installed was: 

  • pgdg-keyring
  • postgresql-10
  • postgresql-client-10
  • postgresql-client-common
  • postgresql-common

so, my purge remove command will look like this:

sudo apt-get --purge remove  pgdg-keyring postgresql-10 postgresql-client-10 postgresql-client-common postgresql-common

Step 3:  Verifying the Deletion of PostgreSQL

Once you remove these packages you should no longer be able to enter into the PostgreSQL environment.  You can verify that by running the grep command again and searching for postgres:

root@newclient:~# dpkg -l | grep postgresroot@newclient:~#

As you can see, there is no output from that command which means, PostgreSQL has been successfully uninstalled! 

If you have other thoughts or questions, our Sales and Support teams are standing by 24 hours a day by phone or e-mail to assist. Reach out to us by opening a support ticket at support@liquidweb.com, giving us a call at 1-800-580-4985 or, open a chat with us and we’ll be happy to answer any questions you may have!

Thank you for hosting with Liquidweb!

About the Author: Justin Palmer

Have Some Questions?

Our Sales and Support teams are available 24 hours by phone or e-mail to assist.

1.800.580.4985
1.517.322.0434

Latest Articles

5 Alternatives to GitHub

Read Article

5 Steps to Install and Configure osquery on CentOS 7 & 8

Read Article

Five Steps to Create a Robots.txt File for Your Website

Read Article

Premium Business Email Pricing FAQ

Read Article

Microsoft Exchange Server Security Update

Read Article