Rocky Linux 9 - PostgreSQL 15 설치

안녕하세요. 이번에는 Rocky Linux 9(로키 리눅스)에 PostgreSQL 15를 설치해 보겠습니다.

기본적으로 Rocky Linux 9 등록되어있는 버전은 PostgreSQL 13 버전입니다. 저장소를 추가하는것부터 기본 설치 까지 진행해 보겠습니다.

 

PostgreSQL: Linux downloads (Red Hat family)

 

PostgreSQL: Linux downloads (Red Hat family)

Linux downloads (Red Hat family) The Red Hat family of distributions includes: Red Hat Enterprise Linux Rocky Linux CentOS (7 and 6 only) Fedora Oracle Linux and others. PostgreSQL is available on these platforms by default. However, each version of the pl

www.postgresql.org

 

 

PostgreSQL 15 저장소 추가

$ sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm

 

기존 내장된 PostgreSQL 저장소 비활성화

$ sudo dnf -qy module disable postgresql

 

PostgreSQL 15 설치

$ sudo dnf update

$ sudo dnf install -y postgresql15-server

 

PostgreSQL 15 데이터베이스 구성 초기화

$ sudo postgresql-15-setup initdb

 

PostgreSQL 15 실행 및 서비스 등록

$ sudo systemctl enable postgresql-15
$ sudo systemctl start postgresql-15

 

PostgreSQL 15 상태 확인

Active 상태가 active 로 정상적으로 실행 되어있는지 확인해주시면됩니다.

$ sudo systemctl status postgresql-15

 

PostgreSQL 15 암호화

$ sudo su - postgres
$ psql

 

PostgreSQL 15 암호 변경

아래 이미지 처럼 'sudo passwd postgres' 는 사용자 계정에서 실행해야합니다.

// 사용자 계정에서 실행
$ sudo passwd postgres

$ su – postgres
$ psql -c "ALTER USER postgres WITH PASSWORD 'your-password';"

 

주의

아래와 같이 postgres 계정에서 'sudo passwd postgres' 를 실행 하면 아래와 같이 메시지가 나옵니다.

'exit' 명령어로 기존 사용자 계정으로 돌아온뒤 'PostgreSQL 15 암호 변경' 섹션을 실행하시면 됩니다.