Skip to content

Instantly share code, notes, and snippets.

@vprasadreddy
Created January 16, 2025 16:49
Show Gist options
  • Select an option

  • Save vprasadreddy/f9bb69038f80750cd1384a2516053be1 to your computer and use it in GitHub Desktop.

Select an option

Save vprasadreddy/f9bb69038f80750cd1384a2516053be1 to your computer and use it in GitHub Desktop.
remove-postgresql-from-ubuntu
# Uninstall the PostgreSQL application
sudo apt-get --purge remove postgresql postgresql-doc postgresql-common
# Remove PostgreSQL packages
dpkg -l | grep postgres
sudo apt-get --purge remove <package_name>
#Remove PostgreSQL directories
sudo rm -rf /var/lib/postgresql/
sudo rm -rf /var/log/postgresql/
sudo rm -rf /etc/postgresql/
# Remove the postgres user
sudo deluser postgres
# Verify uninstallation
psql --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment