"CREATE EXTENSION postgis"가 ""$libdir/postgis-3" 파일에 액세스할 수 없습니다"와 함께 실패합니다.

"CREATE EXTENSION postgis"가 ""$libdir/postgis-3" 파일에 액세스할 수 없습니다"와 함께 실패합니다.
# dnf list installed | grep postgresql
VRTSnbpostgresqlagent.x86_64                  9.1.0.0-1620848511                                  @System                
postgresql.x86_64                             10.17-2.module+el8.5.0+11838+8dca950a               @rhel8-appstream       
postgresql-server.x86_64                      10.17-2.module+el8.5.0+11838+8dca950a               @rhel8-appstream       
postgresql10.x86_64                           10.22-1PGDG.rhel8                                   @rhel8-pgdg10          
postgresql10-contrib.x86_64                   10.22-1PGDG.rhel8                                   @rhel8-pgdg10          
postgresql10-libs.x86_64                      10.22-1PGDG.rhel8                                   @rhel8-pgdg10          
postgresql10-server.x86_64                    10.22-1PGDG.rhel8                                   @rhel8-pgdg10
# dnf list installed | grep postgis
postgis31_10.x86_64                           3.1.7-1.rhel8                                       @rhel8-pgdg10          
postgis31_10-client.x86_64                    3.1.7-1.rhel8                                       @rhel8-pgdg10          
postgis31_10-devel.x86_64                     3.1.7-1.rhel8                                       @@commandline          
postgis31_10-utils.x86_64                     3.1.7-1.rhel8                                       @@commandline

(내 동료가 후자의 두 패키지를 어딘가에서 수동으로 다운로드했습니다.)

시도하면 CREATE EXTENSION postgis;다음 오류가 발생합니다.

ERROR:  could not access file "$libdir/postgis-3": No such file or directory

PostgreSQL 설치 위치 /usr/pgsql-10/와 내부 에는 확장명(예: )을 가진 파일이 /usr/pgsql-10/lib있습니다 . 내부에는 다음을 포함하는 postgis*.control 파일이 있습니다..sopostgis-3.so/usr/pgsql-10/share/extension

# postgis extension
comment = 'PostGIS geometry and geography spatial types and functions'
default_version = '3.1.7'
module_pathname = '$libdir/postgis-3'
relocatable = false

libdir=/usr/pgsql-10/lib파일에 줄을 추가 하려고 하면 오류가 발생하지만 경로를 include 로 ERROR: unrecognized parameter "libdir" in file "/usr/share/pgsql/extension/postgis.control"바꾸면 이전과 동일한 오류가 발생합니다 . 또한 PostGIS가 아닌 다른 확장 프로그램을 설치하려고 시도했지만 비슷한 오류가 발생했습니다.module_pathname/usr/pgsql-10/libERROR: could not access file "$libdir/postgis-3": No such file or directorycould not access "$libdir/extension"

서버는 일부 Postgis 패키지 설치를 도운 IT 직원이 관리하므로 여기에 패키지 유니버스 불일치가 있는지 확실하지 않습니다.

읽은 후 추가 배경지식이 답변/pgdata, PostgreSQL 데이터 디렉터리가 공간상의 이유로 다른 위치( )에 설치되어 있는데 구성 변경에서 뭔가 누락된 것이 아닐까요?

답변1

비슷한 문제가 있었는데 postgresql동시에 두 가지 버전이 설치되어 있는 것으로 나타났습니다. 당신이 보여준 것에서 postgresql.x86_64및 를 제거해야한다고 생각합니다 postgresql-server.x86_64. 를 사용하여 삭제할 수 있습니다 dnf remove.

dnf reinstall호환되지 않는 패키지를 제거한 후 올바른 패키지를 다시 설치해야 할 수도 있습니다.

답변2

하위 문자열이 포함된 버전의 패키지는 PGDG업스트림 postgres rpm 저장소에서 가져온 것입니다.

https://www.postgresql.org/download/linux/redhat/

RHEL 자체 저장소에서 모듈로 제공되는 병렬 설치 Postgres 서버가 업스트림 버전을 방해하는 것으로 보입니다.

또는 실수로 rhel postgres 서버 및/또는 명령에 액세스하고 있습니다. Postgis 패키지는 업스트림 버전에만 설치되므로 이는 의미가 있습니다.

postgres 업스트림 rpm 저장소 지침에는 다음도 포함됩니다.

sudo dnf -qy module disable postgresql

물론, postgres에 대한 rhel의 지원을 활용하려면 rhel에서 제공하는 postgres 패키지를 고수하고 업스트림 패키지 대신 이를 사용해야 합니다(즉, 데이터베이스 데이터를 마이그레이션하고 업스트림 패키지를 제거함).

그러나 rhel이 Postgis도 패키지로 제공하는지 확실하지 않습니다.

관련 정보