CentOS 7에서 Postgresql 9.6.2, Postgis 2.3.2-1 설치(인터넷 환경)

인터넷이 되는 환경에서 PostgreSQL(9.6.2)와 PostGIS(2.3.2)를 설치하는 절차입니다.

PostgreSQL 9.6.2 설치

1. PostgreSQL과 PostGIS 설치를 위한 yum 저장소 업데이트

rpm -Uvh https://yum.postgresql.org/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm

2. PostgreSQL 설치

yum install postgresql96-server postgresql96

3. 데이터베이스 저장소 생성

./postgresql96-setup initdb

4. PostgreSQL 서비스 실행

systemctl enable postgresql-9.6
systemctl enable postgresql-9.6.service
systemctl start postgresql-9.6.service

5. 방화벽에서 port 5432번 개방

firewall-cmd --zone=public --add-port=5432/tcp

6. 외부에서 DBMS 접근 허용 설정

vi postgresql.conf

아래처럼 편집

listen_addresses = "*"

7. postgres 사용자 암호 설정

su - postgres
psql
\password postgres
\q

8. 이전 사용자로 복귀
su - root

9. 외부 접속을 위한 보안설정 변경

vi pg_hba.conf

아래처럼 편집

local all all peer 문자열을 local all all md5 로 변경
host all all 127.0.0.1/32 ident 문자열을 host all all 0.0.0.0/0 md5 로 변경
host all all ::1/128 ident 문자열을 host all all ::1/128 md5 로 변경

10. PostgreSQL 서비스 재기동

systemctl stop postgresql-9.6.service
systemctl start postgresql-9.6.service

11. [2017-07-08 추가] UUID 확장 기능 설치를 위해 다음 명령이 필요함

systemctl stop postgresql-9.6.service
yum install postgresql96-contrib.x86_64
systemctl start postgresql-9.6.service

PostGIS 설치

yum install epel-release
yum install postgis2_96.x86_64
systemctl restart postgresql-9.6.service

“CentOS 7에서 Postgresql 9.6.2, Postgis 2.3.2-1 설치(인터넷 환경)”에 대한 한개의 댓글

  1. systemctl start postgresql-9.6.service 에서 Job for postgresql-9.6.service failed because the control process exited with error code. 로 나옵니다.
    systemctl status postgresql-9.6.service 하게 되면 Loaded: loaded (/usr/lib/systemd/system/postgresql-9.6.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) 나오면서 서비스가 올라가지 않네요.
    앞서 ./postgresql96-setup initdb 하면 Data directory is not empty!로 나오네요.

박준현에 답글 남기기 응답 취소

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다