PGDG(PostgreSQL Global Development Group) YUM 저장소를 쓴다. 릴리스 RPM 이 .repo 파일을 깔아 준다.
| OS | 저장소 RPM | 상태 |
|---|---|---|
| RHEL 9 계열 | .../reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm |
응답 |
| RHEL 8 계열 | .../reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm |
응답 |
| RHEL 7 계열 | .../reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm |
응답하나 OS 가 EOL |
주소 앞부분은 https://download.postgresql.org/pub/repos/yum 이다.
계열이 달라도 흐름은 같다. 버전 숫자와 OS 만 바뀐다.
postgresql 모듈 비활성화 — RHEL 8 이상에서 필요하다. 하지 않으면 OS 버전 패키지가 우선한다postgresqlNN-server 설치initdb 로 데이터 디렉터리 초기화데이터 디렉터리를 기본 위치가 아닌 곳에 두려면 Data Directory 변경 을 먼저 볼 것.
createuser --interactive
Enter name of role to add: haedong
Shall the new role be a superuser? (y/n) y
# 사용자 전환
su - postgres
# DB 접속
psql
# 패스워드 변경
alter user haedong with password 'PASSWORD';
# DB 생성
create database haedong;
vi /var/lib/pgsql/data/11/pg_hba.conf
# 다음 라인을 추가한다.
host all all 0.0.0.0/0 md5
# 만약 host all all 127.0.0.1/32 md5 가 존재한다면 지워준다
# 즉 허용하는 IP에 두개 이상의 인증이 함께 있으면 안된다
전략...
# "local" is for Unix domain socket connections only
local all all peer
local all all ident
local all all md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
host all all 0.0.0.0/0 md5
# IPv6 local connections:
host all all ::1/128 ident
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication postgres peer
#host replication postgres 127.0.0.1/32 ident
#host replication postgres ::1/128 ident
psql -h 192.168.0.100 -u haedong -W
listen_addresses = '*'
port = 5432
max_connections = 100
shared_buffers = 256MB
dynamic_shared_memory_type = posix
log_destination = 'stderr'
logging_collector = on
log_directory = '/var/log/postgresql'
log_filename = 'postgresql-%a.log'
log_truncate_on_rotation = on
log_rotation_age = 1d
log_rotation_size = 0
log_line_prefix = '%m [%p] '
log_timezone = 'Asia/Seoul'
datestyle = 'iso, ymd'
timezone = 'Asia/Seoul'
lc_messages = 'ko_KR.UTF-8'
lc_monetary = 'ko_KR.UTF-8'
lc_numeric = 'ko_KR.UTF-8'
lc_time = 'ko_KR.UTF-8'
default_text_search_config = 'pg_catalog.simple'
wal_buffers = 8MB
max_wal_size = 1GB
min_wal_size = 80MB
checkpoint_completion_target = 0.9
최신 버전 v18.6 — 2026-09-16 확인 ↩︎