IT 관련/PostgreSQL

rhel9.2 repo + postgresql16 install

상어 우두머리 2026. 4. 7. 22:03
728x90
# RHEL 9.2용 표준 레포지토리 직접 생성 (Rocky 9 미러 활용)
sudo tee /etc/yum.repos.d/rhel9.repo <<'EOF'
[baseos]
name=Rocky Linux 9 - BaseOS
baseurl=https://dl.rockylinux.org/pub/rocky/9/BaseOS/x86_64/os/
gpgcheck=0
enabled=1

[appstream]
name=Rocky Linux 9 - AppStream
baseurl=https://dl.rockylinux.org/pub/rocky/9/AppStream/x86_64/os/
gpgcheck=0
enabled=1

[crb]
name=Rocky Linux 9 - CRB
baseurl=https://dl.rockylinux.org/pub/rocky/9/CRB/x86_64/os/
gpgcheck=0
enabled=1
EOF
# 캐시 초기화 및 레포지토리 인식 확인
sudo dnf clean all
sudo dnf makecache
# 1. PostgreSQL 공식 저장소(Repository) 추가
sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm


# 1. 내장 모듈 비활성화 (기존 버전과의 충돌 방지)
sudo dnf -qy module disable postgresql

# 2. 요청하신 4가지 패키지 특정 버전 설치
# postgresql16 (클라이언트), server (엔진), libs (라이브러리), contrib (추가 도구)
sudo dnf install -y \
  postgresql16-16.1-2PGDG.rhel9.x86_64 \
  postgresql16-server-16.1-2PGDG.rhel9.x86_64 \
  postgresql16-libs-16.1-2PGDG.rhel9.x86_64 \
  postgresql16-contrib-16.1-2PGDG.rhel9.x86_64 \
  --allowerasing

# 3. 데이터베이스 초기화
sudo /usr/pgsql-16/bin/postgresql-16-setup initdb

# 4. 서비스 등록 및 시작
sudo systemctl enable postgresql-16
sudo systemctl start postgresql-16

# 5. 최종 버전 및 상태 확인
sudo systemctl status postgresql-16 --no-pager
sudo su - postgres -c "psql --version"
728x90