Search code examples
linuxpostgresqlcentospostgis

How to install postgis on this Centos 8 system? Getting "Error: Problem: cannot install the best candidate for the job"


Related question: Why is installing PostGIS 3 on RHEL 8 / CentOS 8 impossible?

System versions: CentOS, 8 Postgres, 12.3

This is a production db so I cannot uninstall/reinstall postgres. I did dnf install postgis31_13 on a different server with no issues and can't figure out why it's not working on this system.

I try to do dnf install postgis31_12 and it returns the following error:

[user@computer ~]# dnf install postgis31_12
Last metadata expiration check: 0:21:12 ago on Tue Oct 19 19:22:40 2021.
Error:
 Problem: cannot install the best candidate for the job
  - nothing provides geos39 >= 3.9.1 needed by postgis31_12-3.1.4-1.rhel8.x86_64
  - nothing provides gdal33-libs >= 3.3.1 needed by postgis31_12-3.1.4-1.rhel8.x86_64
  - nothing provides proj81 >= 8.1.0 needed by postgis31_12-3.1.4-1.rhel8.x86_64
  - nothing provides libSFCGAL.so.1()(64bit) needed by postgis31_12-3.1.4-1.rhel8.x86_64
  - nothing provides libproj.so.22()(64bit) needed by postgis31_12-3.1.4-1.rhel8.x86_64
  - nothing provides SFCGAL needed by postgis31_12-3.1.4-1.rhel8.x86_64
  - nothing provides libgeotiff16 needed by postgis31_12-3.1.4-1.rhel8.x86_64
  - nothing provides libgdal.so.29()(64bit) needed by postgis31_12-3.1.4-1.rhel8.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

I tried dnf install postgis31_12 --nobest and that returns the same thing but about triple the number of lines of "nothing provides ..."

Other things I tried which didn't do anything:

  • different postgis versions
  • retrying after dnf install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
  • dnf --enablerepo=PowerTools install postgis31_12 from the related question
  • dnf --disablerepo AppStream install postgis31_12
  • this series of commands from the related question:
dnf -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
dnf -qy module disable postgresql
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
dnf --enablerepo=PowerTools install postgresql12-contrib postgis30_12

On the other working server (also Centos 8) I did dnf list --installed and noticed geos39 and SFCGAL are present and from the @pgdg-common repository, which is detailed here on postgresql.org and I believe downloaded from here: https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm

I think I need to somehow make the dnf install include the @pgdg-common repository but I'm not sure how (or if it already is). I have already downloaded it... is there something else I need to do with it? Is there some other issues, or any other information that can clarify the situation?


edit: dnf list | grep pgdg-common returns nothing. Definitely looks like dnf install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm did not make pgdg-common available to dnf but I believe that's all that should be required.


Solution

  • The problem ended up being that

    dnf install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
    

    created a pgdg-redhat-all.repo.rpmnew in /etc/yum.repos.d/. This happens when pgdg-redhat-all.repo has been edited and was resolved by adding the pgdg-common stuff from pgdg-redhat-all.repo.rpmnew to pgdg-redhat-all.repo. Then I ran dnf install postgis31_12 and it completed successfully.

    This scenario is accounted for in https://www.postgresql.org/about/news/announcing-common-yum-repository-2027/