OS : CentOS 7.9
Version : PostgreSQL 14
# rpm -ivh pgdg-redhat-repo-latest.noarch.rpm
설치 안내 : https://www.postgresql.org/download/linux/redhat/
1) 해당 사이트에 접속하여 원하는 버전을 선택한다.
2) Script를 복사하여 설치한다.
Script)
# yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
# yum install -y postgresql14-server
# /usr/pgsql-14/bin/postgresql-14-setup initdb
# systemctl enable postgresql-14
# systemctl start postgresql-14
※ 참고
postgresql rpm으로 설치를 원할 경우 다운 받을 수 있는 사이트
https://yum.postgresql.org/14/redhat/rhel-7-x86_64/repoview/postgresqldbserver14.group.html
# psql --version
or psql -V
로 버전 확인
1) postgresql.conf 수정
어디서든 접속할 수 있도록 설정
# vi /var/lib/pgsql/14/data/postgresql.conf
localhost 를 *로 변경
# - Connection Settings -
# listen_addresses = 'localhost' # what IP address(es) to listen on;
listen_addresses = '*'
2) pg_had.conf 수정
모든 IP 접속을 허용하도록 설정
# vi /var/lib/pgsql/14/data/pg_hba.conf
127.0.0.1/32 → 0.0.0.0/0 으로 변경
scram-sha-256 → md5로 변경
- scram-sha-256 : 사용자 패스워드 방식 인증. sha256 패스워드 방식을 지원해야 함.
- md5 : 사용자 패스워드 방식 인증. 구버전 방식으로 암호화 알고리즘 취약성이 있어 사용을 지양.
# IPv4 local connections:
#host all all 127.0.0.1/32 scram-sha-256
host all all 0.0.0.0/0 md5