Today, let’s discuss how you may Uninstall Psql in the Ubuntu Linux system. As a part of our Server Management Services, Bobcares get often requests to uninstall PostgreSQL queries.
Now let’s see how our Support Engineer did this for our customers with simpler steps.
How to Uninstall PostgreSQL in Ubuntu
PostgreSQL is one of the popular database software used by many websites & organizations. However, If you’re using PostgreSQL, you may require to remove the package at some point. It’s as important to know how to uninstall PostgreSQL properly to make sure all components of the package have fully detached from the system.
Let’s begin with the simple steps of uninstalling PostgreSQL from the Ubuntu operating system. This entire process is split into different parts.
- Uninstall the PostgreSQL application
- Remove dependencies
- Remove Folders
- Remove users – ( optional )
1. Uninstall PostgreSQL
Initially, Open the SSH terminal and run the below command to perform PostgreSQL removal from Ubuntu.
$ sudo apt-get --purge remove postgresql
To uninstall the PostgreSQL application we have used purge
command, which helps to remove the packages with configuration files.
2. List Dependent Packages
Before removing PostgreSQL dependencies, make sure to look at all the dependencies as we are calling this process important because even at this stage you can save up the data before deleting forever.
Run the below command to list all dependent packages available.
$ dpkg -l | grep postgres
Eventually, Dependencies can be removed by passing the name of single files that are mentioned from the above output. Likewise, you will get a screen that will prompt asking for confirmation, simply click enter for yes.
Later, remove the packages listed in the output using the given command below:
$ apt-get --purge remove package1 package2
3. Remove Folder
Further, we have to remove PostgreSQL folders that are generally present in lib, var, and etc folders.
sudo rm -rf /var/lib/postgresql/
sudo rm -rf /var/log/postgresql/
sudo rm -rf /etc/postgresql/
4. delete user Postgres :
The last optional step in the process is to remove the users that adapted in PostgreSQL. By default, a Postgres user will create while installing PostgreSQL, we can remove them. If you have created any other user you can also remove it with the same command used, just replace the Postgres with a username.
sudo deluser postgres
3. Verify Uninstallation
Finally, you can verify whether PostgreSQL have removed or not by running the ” whereis ” command:
$ whereis postgres
$ whereis postgresql
Conclusion
In brief, PostgreSQL is the oldest yet the most advanced database management system. One could also say, it is important to Uninstall Psql Ubuntu very carefully, taking shortcuts when it comes to the removal process can leave highly sensitive data still remaining on your system.
PREVENT YOUR SERVER FROM CRASHING!
Never again
lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server
24/7 so that it remains lightning fast and secure.
0 Comments