Yum: the same packages in two repositories, force to install the package from a different repo

repositoryyum

I am developing a PostgresDB plugin. The plugin is being run in Postgres in Centos 6.3. To be able to compile my project, I had to install some of the libraries from the epel repository and some from the rpmforge. Interestengly enough some of the packages are duplicated in both repositories, e.g.,:

# yum whatprovides postgis

Loaded plugins: fastestmirror, presto, priorities, refresh-packagekit
Loading mirror speeds from cached hostfile
 * Webmin: download.webmin.com
 * base: mirror2.hs-esslingen.de
 * epel: mirror.awanti.com
 * extras: mirror2.hs-esslingen.de
 * rpmforge: mirror.nl.leaseweb.net
 * updates: mirror.netcologne.de
postgis-1.5.3-1.el6.x86_64 : Geographic Information Systems Extensions to
                           : PostgreSQL
Repo        : epel
Matched from:



postgis-1.3.6-1.el6.rf.x86_64 : Geographic Information Systems Extensions to
                              : PostgreSQL
Repo        : rpmforge
Matched from:

Now my project compiles, but does not link with missing references:

/usr/pgsql-9.1/lib/postgis-1.5.so: undefined reference to `accumArrayResult'
/usr/pgsql-9.1/lib/postgis-1.5.so: undefined reference to `TupleDescGetAttInMetadata'
/usr/pgsql-9.1/lib/postgis-1.5.so: undefined reference to `repalloc'
/usr/pgsql-9.1/lib/postgis-1.5.so: undefined reference to `SPI_exec'
/usr/pgsql-9.1/lib/postgis-1.5.so: undefined reference to `init_MultiFuncCall'

which most probably means, that some packages got mixed up: some are install from one repo, and some from the other.

Questions: (i) how can I tell yum to install the package from one repo and then reinstall from the other (to see whether the linking errors would go away); (ii) how can I see what packages on the system are installed from one repo and what from the other?

Best Answer

yum list installed will tell you from what repo a given package was installed, e.g.:

bonnie++.x86_64                     1.96-2.el6                  @epel/6.2  

To select which variant to install, just use the exact name of the variant you want to install from your whatprovides list:

yum install postgis-1.3.6-1.el6.rf.x86_64

For more info, see the specify package names section of man yum.