4

I just installed Postgres 9.6 on CentOS 7. However when I run

[root@server tmp]# /usr/bin/psql --version
psql (PostgreSQL) 9.2.23

It still seems to be pointing to my old version. How do I uninstall the old version (or figure out what its called) without harming the new version?

Dave
  • 753
  • 10
  • 22
  • 39

2 Answers2

2

The newer version of Postgres will be in /usr/pgsql-9.6 (or a similar location) so you can simply use the alternatives command to make this one the default.

Gaius
  • 11,238
  • 3
  • 32
  • 64
0

If you check the running processes ps -ef|grep post you can see which version of postgres is currently running. All you have to do is:

1. Stop the postgres version you want to delete / uninstall.
2. Delete the 'bin' and 'data' directories of the postgres version you just stopped.
3. If you are using tablespaces, delete the contents of your tablespace location as well.
4. Remove entries of the postgres version from file '/etc/postgres-reg.ini' and all the postgres version specific files from '/etc/init.d' location.

BTW, if you have used the one step installer to install the postgres, it creates an uninstall-postgresql file just before the bin directory location. You can use that to uninstall as well, it will automatically perform above steps.

Lohit Gupta
  • 263
  • 1
  • 11