# postgresql10, postgis YUM 저장소 업데이트
rpm -Uvh https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm
위의 url은 변경될 수 있으며 2020년 8월 31일에는 rpm -Uvh https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm로 하여 설치를 진행했으며, postgresql은 10.10.14를, postgis는 3.0.2를 설치하였음.
# 데이터베이스 설치
yum install postgresql10-server.x86_64 postgresql10
# 데이터베이스 저장소 생성
cd /usr/pgsql-10/bin/
./postgresql-10-setup initdb
# 서비스 실행
systemctl enable postgresql-10
systemctl enable postgresql-10.service
systemctl start postgresql-10.service
# 5432 포트 방화벽 허용
firewall-cmd –zone=public –add-port=5432/tcp
# 외부 접속 허용
cd /var/lib/pgsql/10/data
vi postgresql.conf
(편집 내용)
listen_address = “*”
# 암호설정
su – postgres
psql
\password postgres
\q
su – root
# 외부 접속을 위한 보안 설정
cd /var/lib/pgsql/10/data
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 로 변경
# PostGIS 설치
yum install epel-release
yum install postgis24_10.x86_64
systemctl restart postgresql-10.service