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.
[su_box title=”Note:” style=”glass” box_color=”#3ac6eb” radius=”20″]It’s essential to back up any databases you may need, do so before making deletions to your system.[/su_box]
Step 1: List the PostgreSQL Packages
Use the dpkg tool to list packages pertaining to the PostgreSQL setup.
dpkg -l | grep postgresOutput:
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-commonStep 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 [email protected], or open a chat with us and we’ll be happy to answer any questions you may have regarding your dedicated, cloud, or VPS server.
Thank you for hosting with Liquid Web!
Justin Palmer