# Install the repository RPM:
sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
# Install PostgreSQL:
sudo yum install -y postgresql11-server
# Optionally initialize the database and enable automatic start:
sudo /usr/pgsql-11/bin/postgresql-11-setup initdb
sudo systemctl enable postgresql-11
sudo systemctl start postgresql-11
sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
sudo dnf -qy module disable postgresql
sudo dnf install -y postgresql12-server
sudo /usr/pgsql-12/bin/postgresql-12-setup initdb
sudo systemctl enable postgresql-12
sudo systemctl start postgresql-12
/usr/bin/postgresql-11-setup initdb
systemctl enable postgresql-11 --now
h3. 사용자 생성
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