xxxxxxxxxx
sudo apt-get --purge remove postgresql
sudo apt-get purge postgresql*
sudo apt-get --purge remove postgresql postgresql-doc postgresql-common
xxxxxxxxxx
sudo apt-get purge postgresql-<version>
# some cleanups
sudo apt-get autoremove
sudo rm -rf /etc/postgresql
sudo rm -rf /var/lib/postgresql
sudo find / -iname "*postgres*" -exec rm -rf {} \;
xxxxxxxxxx
sudo apt-get --purge remove postgresql postgresql-doc postgresql-common
xxxxxxxxxx
Follow the commands:
sudo apt-get --purge remove postgresql
List all postgres related packages:
dpkg -l | grep postgres
remove all the above listed packages using the command :
apt-get --purge remove package1 package2 ..
Confirm all the files and folders related to postgres/postgresql are deleted using the command :
whereis postgres
whereis postgresql
Remove all the files and folders listed using rm command.
Delete the user postgres using the command :
userdel -f postgres
happy coding :)