Why do I have 2 versions of psql, pg_dump and other tools?

Hello experts,

In Scientific Linux 6.3 (haven't tested this in CentOS), why do I have 2 versions of tools such as psql and pg_dump?:
[root@sl ~]# find / -name psql

Open in new window

My installation process boils down to these steps:
rpm -i http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-sl93-9.3-1.noarch.rpm
yum install postgresql93-server postgresql93-contrib postgresql-contrib 
service postgresql-9.3 initdb

Open in new window

So when I invoke the tools without an absolute path:

WARNING: psql version 8.4, server version 9.3.

And the most important question would be, how can I fix this in a cleanly manner? I see the following recommendation but its more like a workaround to me:

LVL 20
José MéndezAsked:
Who is Participating?
José MéndezConnect With a Mentor Author Commented:
Its the postgresql-contrib package the one that introduces the duplicate tools!!! I am trying to figure out now why that one is needed.
José MéndezAuthor Commented:
Ok I just added this line to the end of my .bashrc :

export PATH=/usr/pgsql-9.3/bin:$PATH

Open in new window

Would still want some input about this method of fixing it, and if someone could please help me understand why are there 2 versions of the tools, that would be awesome.

earth man2Commented:
IThought you use
rpm -U
to update an installation else you risk a double install.
You can use rpm to uninZstall a package.  Sorry I don't have experience of this flavour of Linux.  I use Fedora.
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

José MéndezAuthor Commented:
the rpm line is meant to install the repo =S, but I get your point, if the software is already there, instead of installing, I'll need to figure out how to update the tools from this new repo I added. Not sure why since the yum command is not specific for the tools
earth man2Commented:
to relocate default ie default package dir is in conflict with your current install you could try

rpm -i --relocate /usr/pgsql-9.3/bin=/usr/bin packagename.rpm

yum --installroot=<path> install <package>

These tools have a verbose / dry run mode so you can see what files will be acted upon.
You must run correct client to get rid of the warning
Since you installed from postgresql.org rpm, the system included psql is obsolete.
Jack FrostCommented:
You may not have two versions.  You might want to check using ls -l and see if the entry in /usr/bin is a symlink to the actual program.  Many entries in /usr/bin are like that.  It gives you version independent access that survives through updates.
You can have at least 4 versions.... All supported and running at once... (SCL, postgresql.org and one in system)
If you post output of "rpm -qa | grep postg" and somebody might be able to help... Otherwise close the question.
José MéndezAuthor Commented:
Here are the correct steps to install, taken from www.postgresql.org/download/linux/redhat/, from which I got errors back in like 2012 or something (for Scientific Linux):

yum install http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-sl93-9.3-1.noarch.rpm
yum install postgresql93.x86_64 postgresql93-contrib.x86_64

Now I have
# psql -V
psql (PostgreSQL) 9.3.4


Thanks all!!

P:S.: Gheist you posted 3 times in this thread, none of which had ANY sense. Whats with the power trip telling people to close out their questions if your demands are not met?? LOL
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.