반응형

1. PostgreSQL 9.6 설치

  - RPM 다운로드 

yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm

  - yum 업데이트

yum -y update

  - PostgreSQL 설치

yum -y install postgresql96 postgresql96-server postgresql96-contrib postgresql96-libs

  - DB 초기화

/usr/pgsql-9.6/bin/postgresql96-setup initdb

  - 서비스 등록

systemctl start postgresql-9.6

  - 테스트

ps -ef | grep postgres

PostgreSQL 9.6 설치 후 테스트 화면

- 접속

su – postgres
psql

- 사용자 비밀번호 변경

ALTER USER postgres WITH PASSWORD '{사용할 비밀번호}';

2. 외부 접속설정

- pg_hba.conf 파일 수정

vi /var/lib/pgsql/9.6/data/pg_hba.conf

맨 아래줄에 아래 내용 추가 
host all all 0.0.0.0/0 password

- postgresql.conf 파일 수정

vi /var/lib/pgsql/9.6/data/postgresql.conf

listen_address = '127.0.0.1' 을 listen_address = '*' 로 변경
* 주석처리 되어 있으면 주석 해제

- 서비스 재시작

systemctl restart postgresql-9.6

- 방화벽 포트 열기

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

- Test
firewall-cmd --zone=public --list-all

3. PostGIS 2.4 설치

  - 설치 (OS)

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

  - PostGIS 활성화 (쿼리)

CREATE EXTENSION postgis;
반응형

+ Recent posts