Immersion In Data

PostgreSQL

[CentOS 7.9] EDB 16 설치

sungjunminn 2024. 1. 9. 16:02

OS 환경 : CentOS 7.9

DB 환경 : EDB 16

 

 

1. 셸 스크립트 다운로드 

# curl -1sLf 'https://downloads.enterprisedb.com/wi3ItJeo3GdTmOetweJRGV1suTD4qOPl/enterprise/setup.rpm.sh' | sudo -E bash

 

 

2. 패키지 설치

# yum -y install edb-as16-server

 

 

3. 자동 설치된 enterprisedb 유저 비밀번호 변경

# passwd enterprisedb

 

 

4. 데이터베이스 클러스터 초기화

# cd /usr/edb/as16/bin/
# ./edb-as-16-setup initdb

 

 

5. postgresql.conf 파일 편집

# cd /var/lib/edb/as16/data
# vi postgresql.conf

 

 

6. pg_hba.conf 파일 편집

# vi pg_hba.conf

 

 

7. enterprisedb 유저 환경설정

# su - enterprisedb
# vi ~/.bash_profile

# source ~/.bash_profile

 

 

8. 방화벽 해제

# su - root
# systemctl stop firewalld
# systemctl status firewalld

 

 

8.  EDB 클러스터 기동

# systemctl status edb-as-16.service --상태체크
# systemctl enable edb-as-16.service --활성화
# systemctl start edb-as-16.service --기동
# systemctl stop edb-as-16.service --중지

 

 

9. 데이터베이스 서버 시작(데이터 디렉토리 설정)

# su - enterprisedb
# cd /usr/edb/as16/bin
# ./pg_ctl start -D /var/lib/edb/as16/data/

 

 

10. 데이터베이스 생성

# su - enterprisedb

-bash4.2$ psql edb
edb=# CREATE DATABASE hr;  -- hr 데이터베이스 생성
edb=# \c hr  -- hr 데이터베이스 연결
hr=# CREATE TABLE public.dept (deptno numeric(2) NOT NULL CONSTRAINT dept_pk
PRIMARY KEY, dname varchar(14) CONSTRAINT dept_dname_uq UNIQUE, loc
varchar(13));  -- public 스키마에 dept 테이블 생성