이전 PostGIS는 아마존 RDS에 설치하는 방법으로 문제없이 잘 설치되었으나 로컬에 새로운 데이타베이스를 설치하다 오류 발생해서 정리해본다.
PostgreSQL 15 버전에서 Homebrew를 사용하여 로컬에 PostGIS를 설치할 때 발생하는 오류와 이를 해결하는 과정에 대해 알아보겠습니다.
1. 문제 상황
PostGIS를 Homebrew를 통해 PostgreSQL 15에 설치하려 할 때, 다음과 같은 오류가 발생합니다.
CREATE EXTENSION postgis;
ERROR: extension "postgis" is not available
Detail: Could not open extension control file "/opt/homebrew/opt/postgresql@15/share/postgresql@15/extension/postgis.control": No such file or directory.
Hint: The extension must first be installed on the system where PostgreSQL is running.
이 오류는 Homebrew가 PostGIS를 PostgreSQL 14 버전을 기준으로 설치하려고 시도하기 때문에 발생하는 것으로 보입니다.
Homebrew가 PostGIS를 현재 설치된 PostgreSQL 버전에 대응하여 올바르게 연결하지 못하는 문제가 있을 수 있습니다.
2. 해결책: 수동 설치
위의 오류를 해결하기 위해 PostGIS를 수동으로 설치하는 과정은 다음과 같습니다.
# 필요한 디렉토리 생성 및 소유자 변경
sudo mkdir /opt/postgis
sudo chown $(whoami):admin /opt/postgis
# 다운로드 및 압축 해제
cd /opt
wget http://postgis.net/stuff/postgis-3.3.3dev.tar.gz
tar -xvzf postgis-3.3.3dev.tar.gz -C postgis
cd postgis/postgis-3.3.3dev
# 설정 및 빌드
./configure --with-projdir=/opt/homebrew/opt/proj \
--with-protobufdir=/opt/homebrew/opt/protobuf-c \
--with-pgconfig=/opt/homebrew/opt/postgresql@15/bin/pg_config \
--with-jsondir=/opt/homebrew/opt/json-c \
"LDFLAGS=$LDFLAGS -L/opt/homebrew/Cellar/gettext/0.22.4/lib" \
"CFLAGS=-I/opt/homebrew/Cellar/gettext/0.22.4/include"
# 빌드
make
# 설치
make install
이후에 PostgreSQL에 연결하여 PostGIS를 로드하는 단계를 거쳐야 합니다. 이를 통해 PostGIS가 올바르게 PostgreSQL에 설치되고 사용할 수 있게 됩니다.
CREATE EXTENSION postgis;
이제 정상적으로 설치되는것을 확인 할 수 있습니다.
'개발이야기 > DBMS' 카테고리의 다른 글
[PostgreSQL] PostGIS 설치 (0) | 2023.10.25 |
---|---|
postgresql partial index (0) | 2023.09.07 |
[PostgreSQL] ENUM Type (0) | 2023.08.03 |
PostgreSQL에도 oracle reorg와 같은 기능이 있는가? (0) | 2023.08.01 |
[PostgreSQL] Join 알고리즘에 대해... (0) | 2023.08.01 |