How to uninstall Postgresql as either a root or non-root user

Document ID : KB000020323
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

We have installed Postgresql as a non-root user. Now we wish to uninstall. The CA APM Installation and Upgrade Guide says to run the command "uninstall-postgresql", but the file is not found on our system.

Solution:

If you originally installed Postgresql as a root user, the file "uninstall-postgresql" will exist under the home directory of Postgresql, and can be used to perform the uninstall.

If you installed Postgresql as a non-root user this file will not exist.

To uninstall Postgresql originally installed by a non-root user:

Execute the following commands one by one from the console:

Step 1:


     <non_root_user_directory_absolute_path>/opt/database/bin/pg_ctl -D     
     <non_root_user_directory_absolute_path>/opt/database/data stop 

Step 2:

Change directory to:


     <non_root_user_directory_absolute_path>/opt/database/

and execute the following command:


     rm -rf bin doc installer pgAdmin3 scripts stackbuilder include lib postgresql-8.4.5 share

This will perform un-installation using the same approach as "uninstall-postgres".