How To Remove PostgreSQL
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.
Step 1: List the PostgreSQL Packages
Use the dpkg tool to list packages pertaining to the PostgreSQL setup.
dpkg -l | grep postgres
Output:

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 postgres
root@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!
Related Articles:

About the Author: Justin Palmer
Justin Palmer is a professional application developer with Liquid Web
Our Sales and Support teams are available 24 hours by phone or e-mail to assist.
Latest Articles
Best authentication practices for email senders
Read ArticleWhat is SDDC VMware?
Read Article2024 cPanel and Plesk pricing breakdown
Read ArticleCentOS Linux 7 EOL — everything you need to know
Read ArticleHow to install Node.js on Linux (AlmaLinux)
Read Article