How To Remove PostgreSQL

Let’s say you were trying to download PostgreSQL and you realize that not all of the program downloaded, leaving you with files and directories that are taking up space on your server, and begs the question: How do you completely uninstall PostgreSQL?  In this tutorial, we’ll be safely removing PostgreSQL from our Liquid Web Ubuntu 16.04 server.

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


Step 2: Delete the PostgreSQL Packages

In Step 1, you’ll see packages to delete and delete them with one command. Start with apt-get –purge remove followed by each package name separated with a space.  For my particular version of PostgreSQL my command looks like this:

sudo apt-get --purge remove postgresql-9.5 postgresql-client-9.5 postgresql-client-common postgresql-common postgresql-contrib postgresql-contrib-9.5

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 trying to switch to PostgreSQL default user (postgres) or enter into a database.



How to KVM, QEMU start or stop virtual machine from command line (CLI)

KVM or Kernel Based Virtual Machine is a popular virtualization technology. It allows you to run virtual guest machines over a host machine. To start...

How to Docker backup Saving and restoring your volumes

Running a Docker volume backup First, we spin up a temporary container, and we mount the backup folder and the target Docker volume to this container....

How to Start and Enable Firewalld on CentOS 7

In this article, we discuss how to start and enable firewalld. It is highly recommended that you have a firewall protecting your server.Pre-Flight CheckThese...