[PostgreSQL - PostGIS 플러그인 설치]

PostGIS이란,
객체 관계형 데이터베이스 시스템인 PostgreSQL의 확장 프로그램으로, 데이터베이스에 GIS(지리정보 시스템) 객체를 저장할 수 있게 해 줍니다. PostGIS는 GiST 기반 R-Tree 공간 인덱스를 지원하며, GIS 객체의 분석 및 공간 처리를 위한 기능을 포함하고 있습니다.
PostGIS를 사용하면 지리 정보 데이터를 다양하게 다룰 수 있습니다.
 
주요기능 : 공간 데이터 관리, 공간 데이터 연산, 분석, 공간 인덱스 지원 등
공간 인덱스란 특정의 좌표를 찍어 지도 내에서 무언가 사용자가 원하는 데이터를 검색하기 위해서 사용한다고 보면 이해하기 쉽습니다.
 
사용 예시 : 카카오 택시같이 지도내에 있는 택시를 검색해서 호출한다거나, 네이버 지도에서 식당이나 카페를 검색하는 것과 같은 작업을 할때 사용

 

 

■ Repo 추가

[root@jh-post003 yum.repos.d]# yum -y install epel-release

[root@s1833528f4ae ~]#  sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

[root@jh-post003 yum.repos.d]# cd /etc/yum.repo.d


[root@jh-post003 yum.repos.d]# vi pgdg-redhat-all.repo

#######################################################
# PGDG Red Hat Enterprise Linux / CentOS repositories #
#######################################################

# PGDG Red Hat Enterprise Linux / CentOS stable common repository for all PostgreSQL versions

[pgdg-common]
name=PostgreSQL common RPMs for RHEL / CentOS $releasever - $basearch
baseurl=http://download.postgresql.org/pub/repos/yum/common/redhat/rhel-$releasever-$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

# PGDG Red Hat Enterprise Linux / CentOS stable repositories:

[pgdg14]
name=PostgreSQL 14 for RHEL / CentOS $releasever - $basearch
baseurl=http://download.postgresql.org/pub/repos/yum/14/redhat/rhel-$releasever-$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

[pgdg13]
name=PostgreSQL 13 for RHEL / CentOS $releasever - $basearch
baseurl=http://download.postgresql.org/pub/repos/yum/13/redhat/rhel-$releasever-$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

[pgdg12]
name=PostgreSQL 12 for RHEL / CentOS $releasever - $basearch
baseurl=http://download.postgresql.org/pub/repos/yum/12/redhat/rhel-$releasever-$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

[pgdg11]
name=PostgreSQL 11 for RHEL / CentOS $releasever - $basearch
baseurl=http://download.postgresql.org/pub/repos/yum/11/redhat/rhel-$releasever-$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

[pgdg10]
name=PostgreSQL 10 for RHEL / CentOS $releasever - $basearch
baseurl=http://download.postgresql.org/pub/repos/yum/10/redhat/rhel-$releasever-$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

# PGDG RHEL / CentOS Updates Testing common repositories.

[pgdg-common-testing]
name=PostgreSQL common testing RPMs for RHEL / CentOS $releasever - $basearch
baseurl=https://download.postgresql.org/pub/repos/yum/testing/common/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

# PGDG RHEL / CentOS Updates Testing repositories. (These packages should not be used in production)
# Available for 11 and above.

[pgdg16-updates-testing]
name=PostgreSQL 16 for RHEL / CentOS $releasever - $basearch - Updates testing
baseurl=https://download.postgresql.org/pub/repos/yum/testing/16/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

[pgdg15-updates-testing]
name=PostgreSQL 15 for RHEL / CentOS $releasever - $basearch - Updates testing
baseurl=https://download.postgresql.org/pub/repos/yum/testing/15/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

[pgdg14-updates-testing]
name=PostgreSQL 14 for RHEL / CentOS $releasever - $basearch - Updates testing
baseurl=https://download.postgresql.org/pub/repos/yum/testing/14/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

[pgdg13-updates-testing]
name=PostgreSQL 13 for RHEL / CentOS $releasever - $basearch - Updates testing
baseurl=https://download.postgresql.org/pub/repos/yum/testing/13/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

[pgdg12-updates-testing]
name=PostgreSQL 12 for RHEL / CentOS $releasever - $basearch - Updates testing
baseurl=https://download.postgresql.org/pub/repos/yum/testing/12/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

[pgdg11-updates-testing]
name=PostgreSQL 11 for RHEL / CentOS $releasever - $basearch - Updates testing
baseurl=https://download.postgresql.org/pub/repos/yum/testing/11/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

# PGDG Red Hat Enterprise Linux / CentOS SRPM testing common repository

[pgdg-source-common]
name=PostgreSQL 12 for RHEL / CentOS $releasever - $basearch - Source
baseurl=https://download.postgresql.org/pub/repos/yum/srpms/common/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

# PGDG RHEL / CentOS testing common SRPM repository for all PostgreSQL versions

[pgdg-common-srpm-testing]
name=PostgreSQL common testing SRPMs for RHEL / CentOS $releasever - $basearch
baseurl=https://download.postgresql.org/pub/repos/yum/srpms/testing/common/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

# PGDG Source RPMs (SRPM), and their testing repositories:

[pgdg15-source-updates-testing]
name=PostgreSQL 15 for RHEL / CentOS $releasever - $basearch - Source updates testing
failovermethod=priority
baseurl=https://download.postgresql.org/pub/repos/yum/srpms/testing/15/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

[pgdg14-source-updates-testing]
name=PostgreSQL 14 for RHEL / CentOS $releasever - $basearch - Source updates testing
failovermethod=priority
baseurl=https://download.postgresql.org/pub/repos/yum/srpms/testing/14/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

[pgdg13-source-updates-testing]
name=PostgreSQL 13 for RHEL / CentOS $releasever - $basearch - Source updates testing
failovermethod=priority
baseurl=https://download.postgresql.org/pub/repos/yum/srpms/testing/13/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

[pgdg12-source]
name=PostgreSQL 12 for RHEL / CentOS $releasever - $basearch - Source
failovermethod=priority
baseurl=https://download.postgresql.org/pub/repos/yum/srpms/12/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

[pgdg12-source-updates-testing]
name=PostgreSQL 12 for RHEL / CentOS $releasever - $basearch - Source update testing
failovermethod=priority
baseurl=https://download.postgresql.org/pub/repos/yum/srpms/testing/12/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

[pgdg11-source]
name=PostgreSQL 11 for RHEL / CentOS $releasever - $basearch - Source
failovermethod=priority
baseurl=https://download.postgresql.org/pub/repos/yum/srpms/11/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

[pgdg11-source-updates-testing]
name=PostgreSQL 11 for RHEL / CentOS $releasever - $basearch - Source update testing
failovermethod=priority
baseurl=https://download.postgresql.org/pub/repos/yum/srpms/testing/11/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

[pgdg10-source]
name=PostgreSQL 10 for RHEL / CentOS $releasever - $basearch - Source
failovermethod=priority
baseurl=https://download.postgresql.org/pub/repos/yum/srpms/10/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

# Debuginfo/debugsource packages for stable repos

[pgdg14-debuginfo]
name=PostgreSQL 14 for RHEL / CentOS $releasever - $basearch - Debuginfo
baseurl=https://download.postgresql.org/pub/repos/yum/debug/14/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

[pgdg13-debuginfo]
name=PostgreSQL 13 for RHEL / CentOS $releasever - $basearch - Debuginfo
baseurl=https://download.postgresql.org/pub/repos/yum/debug/13/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

[pgdg12-debuginfo]
name=PostgreSQL 12 for RHEL / CentOS $releasever - $basearch - Debuginfo
baseurl=https://download.postgresql.org/pub/repos/yum/debug/12/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

[pgdg11-debuginfo]
name=PostgreSQL 11 for RHEL / CentOS $releasever - $basearch - Debuginfo
baseurl=https://download.postgresql.org/pub/repos/yum/debug/11/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

[pgdg10-debuginfo]
name=PostgreSQL 10 for RHEL / CentOS $releasever - $basearch - Debuginfo
baseurl=https://download.postgresql.org/pub/repos/yum/debug/10/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

# Debuginfo/debugsource packages for testing repos
# Available for 11 and above.

[pgdg15-updates-testing-debuginfo]
name=PostgreSQL 15 for RHEL / CentOS $releasever - $basearch - Debuginfo
baseurl=https://download.postgresql.org/pub/repos/yum/testing/debug/15/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

[pgdg14-updates-testing-debuginfo]
name=PostgreSQL 14 for RHEL / CentOS $releasever - $basearch - Debuginfo
baseurl=https://download.postgresql.org/pub/repos/yum/testing/debug/14/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

[pgdg13-updates-testing-debuginfo]
name=PostgreSQL 13 for RHEL / CentOS $releasever - $basearch - Debuginfo
baseurl=https://download.postgresql.org/pub/repos/yum/testing/debug/13/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

[pgdg12-updates-testing-debuginfo]
name=PostgreSQL 12 for RHEL / CentOS $releasever - $basearch - Debuginfo
baseurl=https://download.postgresql.org/pub/repos/yum/testing/debug/12/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

[pgdg11-updates-testing-debuginfo]
name=PostgreSQL 11 for RHEL / CentOS $releasever - $basearch - Debuginfo
baseurl=https://download.postgresql.org/pub/repos/yum/testing/debug/11/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1


[root@jh-post003 yum.repos.d]# yum clean all

 

 

■ PostGIS Install

## 설치 가능 패키지 확인
[root@jh-post003 yum.repos.d]# yum search postgis*
Loaded plugins: fastestmirror
base                                                                     | 3.6 kB  00:00:00     
epel/x86_64/metalink                                                     | 6.9 kB  00:00:00     
epel                                                                     | 4.7 kB  00:00:00     
http://ftp.iij.ad.jp/pub/linux/Fedora/epel/7/x86_64/repodata/repomd.xml: [Errno -1] repomd.xml does not match metalink for epel
Trying other mirror.
epel                                                                     | 4.7 kB  00:00:00     
extras                                                                   | 2.9 kB  00:00:00     
pgdg-common/7/x86_64/signature                                           |  198 B  00:00:00     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Importing GPG key 0x442DF0F8:
Userid     : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8
Package    : pgdg-redhat-repo-42.0-26.noarch (installed)
From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Is this ok [y/N]: y
pgdg-common/7/x86_64/signature                                           | 2.9 kB  00:00:01 !!!
pgdg10/7/x86_64/signature                                                |  198 B  00:00:00     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Importing GPG key 0x442DF0F8:
Userid     : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8
Package    : pgdg-redhat-repo-42.0-26.noarch (installed)
From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Is this ok [y/N]: y
pgdg10/7/x86_64/signature                                                | 3.6 kB  00:00:02 !!!
pgdg11/7/x86_64/signature                                                |  198 B  00:00:00     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Importing GPG key 0x442DF0F8:
Userid     : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8
Package    : pgdg-redhat-repo-42.0-26.noarch (installed)
From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Is this ok [y/N]: y
pgdg11/7/x86_64/signature                                                | 3.6 kB  00:00:01 !!!
pgdg12/7/x86_64/signature                                                |  198 B  00:00:00     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Importing GPG key 0x442DF0F8:
Userid     : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8
Package    : pgdg-redhat-repo-42.0-26.noarch (installed)
From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Is this ok [y/N]: y
pgdg12/7/x86_64/signature                                                | 3.6 kB  00:00:00 !!!
pgdg13/7/x86_64/signature                                                |  198 B  00:00:00     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Importing GPG key 0x442DF0F8:
Userid     : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8
Package    : pgdg-redhat-repo-42.0-26.noarch (installed)
From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Is this ok [y/N]: y
pgdg13/7/x86_64/signature                                                | 3.6 kB  00:00:00 !!!
pgdg14/7/x86_64/signature                                                |  198 B  00:00:00     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Importing GPG key 0x442DF0F8:
Userid     : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8
Package    : pgdg-redhat-repo-42.0-26.noarch (installed)
From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Is this ok [y/N]: y
pgdg14/7/x86_64/signature                                                | 3.6 kB  00:00:02 !!!
update                                                                   | 2.9 kB  00:00:00     
(1/18): base/7/x86_64/group_gz                                           | 153 kB  00:00:00     
(2/18): base/7/x86_64/primary_db                                         | 6.1 MB  00:00:00     
(3/18): epel/x86_64/group_gz                                             |  97 kB  00:00:00     
(4/18): epel/x86_64/updateinfo                                           | 1.0 MB  00:00:00     
(5/18): extras/7/x86_64/primary_db                                       | 243 kB  00:00:00     
(6/18): epel/x86_64/primary_db                                           | 7.0 MB  00:00:00     
(7/18): pgdg10/7/x86_64/group_gz                                         |  245 B  00:00:00     
(8/18): pgdg12/7/x86_64/group_gz                                         |  245 B  00:00:00     
(9/18): pgdg11/7/x86_64/group_gz                                         |  245 B  00:00:01     
(10/18): pgdg10/7/x86_64/primary_db                                      | 393 kB  00:00:01     
(11/18): pgdg-common/7/x86_64/primary_db                                 | 163 kB  00:00:01     
(12/18): pgdg13/7/x86_64/primary_db                                      | 213 kB  00:00:00     
(13/18): pgdg13/7/x86_64/group_gz                                        |  246 B  00:00:00     
(14/18): pgdg11/7/x86_64/primary_db                                      | 430 kB  00:00:01     
(15/18): pgdg14/7/x86_64/group_gz                                        |  244 B  00:00:00     
(16/18): update/7/x86_64/primary_db                                      |  12 MB  00:00:00     
(17/18): pgdg14/7/x86_64/primary_db                                      | 131 kB  00:00:00     
(18/18): pgdg12/7/x86_64/primary_db                                      | 311 kB  00:00:01     
Determining fastest mirrors
* epel: mirror.misakamikoto.network
Warning: No matches found for: postgis*
No matches found





## 원하는 버전 설치 (30은 postgis 버전, 12는 postgresql버전 의미)
[root@jh-post003 ~]# yum -y install postgis30_12-3.0.4
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* epel: mirror.misakamikoto.network
Resolving Dependencies
--> Running transaction check
---> Package postgis30_12.x86_64 0:3.0.4-1.rhel7 will be installed
--> Processing Dependency: proj72 >= 7.2.1 for package: postgis30_12-3.0.4-1.rhel7.x86_64
--> Processing Dependency: geos39 >= 3.9.1 for package: postgis30_12-3.0.4-1.rhel7.x86_64
--> Processing Dependency: gdal33-libs >= 3.3.1 for package: postgis30_12-3.0.4-1.rhel7.x86_64
--> Processing Dependency: libprotobuf-c.so.1(LIBPROTOBUF_C_1.0.0)(64bit) for package: postgis30_12-3.0.4-1.rhel7.x86_64
--> Processing Dependency: libgeotiff16 for package: postgis30_12-3.0.4-1.rhel7.x86_64
--> Processing Dependency: SFCGAL for package: postgis30_12-3.0.4-1.rhel7.x86_64
--> Processing Dependency: libprotobuf-c.so.1()(64bit) for package: postgis30_12-3.0.4-1.rhel7.x86_64
--> Processing Dependency: libproj.so.19()(64bit) for package: postgis30_12-3.0.4-1.rhel7.x86_64
--> Processing Dependency: libgdal.so.29()(64bit) for package: postgis30_12-3.0.4-1.rhel7.x86_64
--> Processing Dependency: libSFCGAL.so.1()(64bit) for package: postgis30_12-3.0.4-1.rhel7.x86_64
--> Running transaction check
---> Package SFCGAL.x86_64 0:1.3.1-2.rhel7 will be installed
--> Processing Dependency: CGAL for package: SFCGAL-1.3.1-2.rhel7.x86_64
---> Package SFCGAL-libs.x86_64 0:1.3.1-2.rhel7 will be installed
--> Processing Dependency: libboost_serialization-mt.so.1.53.0()(64bit) for package: SFCGAL-libs-1.3.1-2.rhel7.x86_64
--> Processing Dependency: libboost_date_time-mt.so.1.53.0()(64bit) for package: SFCGAL-libs-1.3.1-2.rhel7.x86_64
---> Package gdal33-libs.x86_64 0:3.3.3-1.rhel7 will be installed
--> Processing Dependency: ogdi41 for package: gdal33-libs-3.3.3-1.rhel7.x86_64
--> Processing Dependency: libspatialite43-devel for package: gdal33-libs-3.3.3-1.rhel7.x86_64
--> Processing Dependency: libgeotiff16-devel for package: gdal33-libs-3.3.3-1.rhel7.x86_64
--> Processing Dependency: libzstd.so.1()(64bit) for package: gdal33-libs-3.3.3-1.rhel7.x86_64
--> Processing Dependency: libspatialite.so.7()(64bit) for package: gdal33-libs-3.3.3-1.rhel7.x86_64
--> Processing Dependency: libopenjp2.so.7()(64bit) for package: gdal33-libs-3.3.3-1.rhel7.x86_64
--> Processing Dependency: libogdi.so.4()(64bit) for package: gdal33-libs-3.3.3-1.rhel7.x86_64
---> Package geos39.x86_64 0:3.9.2-1.rhel7 will be installed
---> Package libgeotiff16.x86_64 0:1.6.0-6.rhel7 will be installed
---> Package proj72.x86_64 0:7.2.1-1.rhel7 will be installed
--> Processing Dependency: sqlite33 for package: proj72-7.2.1-1.rhel7.x86_64
---> Package protobuf-c.x86_64 0:1.0.2-3.el7 will be installed
--> Running transaction check
---> Package CGAL.x86_64 0:4.7-1.rhel7.1 will be installed
--> Processing Dependency: libGLU.so.1()(64bit) for package: CGAL-4.7-1.rhel7.1.x86_64
---> Package boost-date-time.x86_64 0:1.53.0-28.el7 will be installed
---> Package boost-serialization.x86_64 0:1.53.0-28.el7 will be installed
---> Package libgeotiff16-devel.x86_64 0:1.6.0-6.rhel7 will be installed
---> Package libspatialite43.x86_64 0:4.3.0a-15.rhel7 will be installed
---> Package libspatialite43-devel.x86_64 0:4.3.0a-15.rhel7 will be installed
---> Package libzstd.x86_64 0:1.5.2-1.el7 will be installed
---> Package ogdi41.x86_64 0:4.1.0-2.rhel7 will be installed
---> Package openjpeg2.x86_64 0:2.3.1-3.el7_7 will be installed
---> Package sqlite33.x86_64 0:3.30.1-6.rhel7 will be installed
--> Processing Dependency: sqlite33-libs = 3.30.1-6.rhel7 for package: sqlite33-3.30.1-6.rhel7.x86_64
--> Running transaction check
---> Package mesa-libGLU.x86_64 0:9.0.0-4.el7 will be installed
---> Package sqlite33-libs.x86_64 0:3.30.1-6.rhel7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================
Package                       Arch           Version                 Repository           Size
================================================================================================
Installing:
postgis30_12                  x86_64         3.0.4-1.rhel7           pgdg12              4.7 M
Installing for dependencies:
CGAL                          x86_64         4.7-1.rhel7.1           pgdg-common         254 k
SFCGAL                        x86_64         1.3.1-2.rhel7           pgdg-common          14 k
SFCGAL-libs                   x86_64         1.3.1-2.rhel7           pgdg-common         1.7 M
boost-date-time               x86_64         1.53.0-28.el7           base                 52 k
boost-serialization           x86_64         1.53.0-28.el7           base                169 k
gdal33-libs                   x86_64         3.3.3-1.rhel7           pgdg-common         7.9 M
geos39                        x86_64         3.9.2-1.rhel7           pgdg-common         646 k
libgeotiff16                  x86_64         1.6.0-6.rhel7           pgdg-common          94 k
libgeotiff16-devel            x86_64         1.6.0-6.rhel7           pgdg-common          29 k
libspatialite43               x86_64         4.3.0a-15.rhel7         pgdg-common         2.4 M
libspatialite43-devel         x86_64         4.3.0a-15.rhel7         pgdg-common          73 k
libzstd                       x86_64         1.5.2-1.el7             epel                282 k
mesa-libGLU                   x86_64         9.0.0-4.el7             base                196 k
ogdi41                        x86_64         4.1.0-2.rhel7           pgdg-common         218 k
openjpeg2                     x86_64         2.3.1-3.el7_7           base                153 k
proj72                        x86_64         7.2.1-1.rhel7           pgdg-common         2.5 M
protobuf-c                    x86_64         1.0.2-3.el7             base                 28 k
sqlite33                      x86_64         3.30.1-6.rhel7          pgdg-common         624 k
sqlite33-libs                 x86_64         3.30.1-6.rhel7          pgdg-common         550 k

Transaction Summary
================================================================================================
Install  1 Package (+19 Dependent packages)

Total download size: 22 M
Installed size: 106 M
Downloading packages:
(1/20): SFCGAL-1.3.1-2.rhel7.x86_64.rpm                                  |  14 kB  00:00:00     
(2/20): boost-date-time-1.53.0-28.el7.x86_64.rpm                         |  52 kB  00:00:00     
(3/20): boost-serialization-1.53.0-28.el7.x86_64.rpm                     | 169 kB  00:00:00     
(4/20): CGAL-4.7-1.rhel7.1.x86_64.rpm                                    | 254 kB  00:00:01     
(5/20): SFCGAL-libs-1.3.1-2.rhel7.x86_64.rpm                             | 1.7 MB  00:00:01     
(6/20): geos39-3.9.2-1.rhel7.x86_64.rpm                                  | 646 kB  00:00:00     
(7/20): libgeotiff16-1.6.0-6.rhel7.x86_64.rpm                            |  94 kB  00:00:00     
(8/20): gdal33-libs-3.3.3-1.rhel7.x86_64.rpm                             | 7.9 MB  00:00:01     
(9/20): libgeotiff16-devel-1.6.0-6.rhel7.x86_64.rpm                      |  29 kB  00:00:00     
(10/20): mesa-libGLU-9.0.0-4.el7.x86_64.rpm                              | 196 kB  00:00:00     
(11/20): libspatialite43-4.3.0a-15.rhel7.x86_64.rpm                      | 2.4 MB  00:00:00     
(12/20): openjpeg2-2.3.1-3.el7_7.x86_64.rpm                              | 153 kB  00:00:00     
(13/20): libspatialite43-devel-4.3.0a-15.rhel7.x86_64.rpm                |  73 kB  00:00:00     
(14/20): protobuf-c-1.0.2-3.el7.x86_64.rpm                               |  28 kB  00:00:00     
(15/20): ogdi41-4.1.0-2.rhel7.x86_64.rpm                                 | 218 kB  00:00:00     
(16/20): libzstd-1.5.2-1.el7.x86_64.rpm                                  | 282 kB  00:00:00     
(17/20): sqlite33-3.30.1-6.rhel7.x86_64.rpm                              | 624 kB  00:00:00     
(18/20): proj72-7.2.1-1.rhel7.x86_64.rpm                                 | 2.5 MB  00:00:00     
(19/20): sqlite33-libs-3.30.1-6.rhel7.x86_64.rpm                         | 550 kB  00:00:00     
(20/20): postgis30_12-3.0.4-1.rhel7.x86_64.rpm                           | 4.7 MB  00:00:03     
------------------------------------------------------------------------------------------------
Total                                                           3.0 MB/s |  22 MB  00:00:07     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : sqlite33-libs-3.30.1-6.rhel7.x86_64                                         1/20
  Installing : geos39-3.9.2-1.rhel7.x86_64                                                 2/20
  Installing : sqlite33-3.30.1-6.rhel7.x86_64                                              3/20
  Installing : proj72-7.2.1-1.rhel7.x86_64                                                 4/20
  Installing : libgeotiff16-1.6.0-6.rhel7.x86_64                                           5/20
  Installing : libspatialite43-4.3.0a-15.rhel7.x86_64                                      6/20
  Installing : libspatialite43-devel-4.3.0a-15.rhel7.x86_64                                7/20
  Installing : libgeotiff16-devel-1.6.0-6.rhel7.x86_64                                     8/20
  Installing : mesa-libGLU-9.0.0-4.el7.x86_64                                              9/20
  Installing : CGAL-4.7-1.rhel7.1.x86_64                                                  10/20
  Installing : ogdi41-4.1.0-2.rhel7.x86_64                                                11/20
  Installing : boost-date-time-1.53.0-28.el7.x86_64                                       12/20
  Installing : libzstd-1.5.2-1.el7.x86_64                                                 13/20
  Installing : boost-serialization-1.53.0-28.el7.x86_64                                   14/20
  Installing : SFCGAL-libs-1.3.1-2.rhel7.x86_64                                           15/20
  Installing : SFCGAL-1.3.1-2.rhel7.x86_64                                                16/20
  Installing : openjpeg2-2.3.1-3.el7_7.x86_64                                             17/20
  Installing : gdal33-libs-3.3.3-1.rhel7.x86_64                                           18/20
  Installing : protobuf-c-1.0.2-3.el7.x86_64                                              19/20
  Installing : postgis30_12-3.0.4-1.rhel7.x86_64                                          20/20
  Verifying  : protobuf-c-1.0.2-3.el7.x86_64                                               1/20
  Verifying  : openjpeg2-2.3.1-3.el7_7.x86_64                                              2/20
  Verifying  : libgeotiff16-1.6.0-6.rhel7.x86_64                                           3/20
  Verifying  : SFCGAL-1.3.1-2.rhel7.x86_64                                                 4/20
  Verifying  : gdal33-libs-3.3.3-1.rhel7.x86_64                                            5/20
  Verifying  : libspatialite43-4.3.0a-15.rhel7.x86_64                                      6/20
  Verifying  : libgeotiff16-devel-1.6.0-6.rhel7.x86_64                                     7/20
  Verifying  : SFCGAL-libs-1.3.1-2.rhel7.x86_64                                            8/20
  Verifying  : boost-serialization-1.53.0-28.el7.x86_64                                    9/20
  Verifying  : libspatialite43-devel-4.3.0a-15.rhel7.x86_64                               10/20
  Verifying  : proj72-7.2.1-1.rhel7.x86_64                                                11/20
  Verifying  : libzstd-1.5.2-1.el7.x86_64                                                 12/20
  Verifying  : sqlite33-3.30.1-6.rhel7.x86_64                                             13/20
  Verifying  : geos39-3.9.2-1.rhel7.x86_64                                                14/20
  Verifying  : boost-date-time-1.53.0-28.el7.x86_64                                       15/20
  Verifying  : postgis30_12-3.0.4-1.rhel7.x86_64                                          16/20
  Verifying  : ogdi41-4.1.0-2.rhel7.x86_64                                                17/20
  Verifying  : sqlite33-libs-3.30.1-6.rhel7.x86_64                                        18/20
  Verifying  : mesa-libGLU-9.0.0-4.el7.x86_64                                             19/20
  Verifying  : CGAL-4.7-1.rhel7.1.x86_64                                                  20/20

Installed:
  postgis30_12.x86_64 0:3.0.4-1.rhel7                                                           

Dependency Installed:
  CGAL.x86_64 0:4.7-1.rhel7.1                       SFCGAL.x86_64 0:1.3.1-2.rhel7              
  SFCGAL-libs.x86_64 0:1.3.1-2.rhel7                boost-date-time.x86_64 0:1.53.0-28.el7     
  boost-serialization.x86_64 0:1.53.0-28.el7        gdal33-libs.x86_64 0:3.3.3-1.rhel7         
  geos39.x86_64 0:3.9.2-1.rhel7                     libgeotiff16.x86_64 0:1.6.0-6.rhel7        
  libgeotiff16-devel.x86_64 0:1.6.0-6.rhel7         libspatialite43.x86_64 0:4.3.0a-15.rhel7   
  libspatialite43-devel.x86_64 0:4.3.0a-15.rhel7    libzstd.x86_64 0:1.5.2-1.el7               
  mesa-libGLU.x86_64 0:9.0.0-4.el7                  ogdi41.x86_64 0:4.1.0-2.rhel7              
  openjpeg2.x86_64 0:2.3.1-3.el7_7                  proj72.x86_64 0:7.2.1-1.rhel7              
  protobuf-c.x86_64 0:1.0.2-3.el7                   sqlite33.x86_64 0:3.30.1-6.rhel7           
  sqlite33-libs.x86_64 0:3.30.1-6.rhel7            

Complete!

 

 

■ Create Extension (에러별 해결방법)

postgres=# CREATE EXTENSION postgis;
CREATE EXTENSION
 
 
※ 에러 발생 1
postgres=# CREATE EXTENSION postgis;
ERROR:  could not open extension control file "/postgresql/share/extension/postgis.control": No such file or directory
- 해결방법 -
## postgis 파일 검색
※ yum 설치시 해당 경로로 파일 생성됨. DB를 해당 yum으로 설치했으면 그냥 이대로해도 되지만 바이너리로 설치시 base경로로 옮겨줘야함.
[root@jh-post003 share]# find / -name postgis.control
/usr/pgsql-12/share/extension/postgis.control


[root@jh-post003 share]# mv /usr/pgsql-12/share/extension/postgis.control /postgresql/share/extension/

 

 
※ 에러 발생 2
postgres=# CREATE EXTENSION postgis;
ERROR:  extension "postgis" has no installation script nor update path for version "3.0.4"
- 해결방법 -
[root@s1833528f4ae ~]# cp -rp /usr/pgsql-12/share/extension/postgis* /postgresql/share/extension/
cp: overwrite ‘/postgresql/share/extension/postgis.control’? y
 
※ 에러 발생 3
postgres=# CREATE EXTENSION postgis;
ERROR:  could not access file "$libdir/postgis-3": No such file or directory
- 해결방법 -
[root@s1833528f4ae ~]# cp -rp /usr/pgsql-12/lib/postgis* /postgresql/lib/
 
 

■ 정상 설치 확인

postgres=# SELECT name, default_version,installed_version FROM pg_available_extensions WHERE name LIKE 'postgis%' or name LIKE 'address%';
          name          | default_version | installed_version
------------------------+-----------------+-------------------
postgis                | 3.0.4           | 3.0.4
postgis_raster         | 3.0.4           |
postgis_sfcgal         | 3.0.4           |
postgis_tiger_geocoder | 3.0.4           |
postgis_topology       | 3.0.4           |
(5 rows)


postgres=# select PostGIS_Full_Version();
                                                                       postgis_full_version                                                                       
------------------------------------------------------------------------------------------------------------------------------------------------------------------
POSTGIS="3.0.4 0599561" [EXTENSION] PGSQL="120" GEOS="3.9.2-CAPI-1.14.3" PROJ="7.2.1" LIBXML="2.9.1" LIBJSON="0.11" LIBPROTOBUF="1.0.2" WAGYU="0.4.3 (Internal)"
(1 row)