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
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:
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
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 email@example.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!
Our Sales and Support teams are available 24 hours by phone or e-mail to assist.