sudo yum -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
#PostgreSQLのインストール
sudo yum -y install postgresql12-server postgresql12-contrib
#PostgreSQLの初期化
sudo /usr/pgsql-12/bin/postgresql-12-setup initdb
#PostgreSQLの自動起動設定
sudo systemctl enable postgresql-12
#Postgresql.confの設定
sudo chmod 777 /var/lib/pgsql/
sudo chmod 777 /var/lib/pgsql/12/
sudo chmod 777 /var/lib/pgsql/12/data
sudo chmod 777 /var/lib/pgsql/12/data/postgresql.conf
#Postgresql.confの設定
sudo vi /var/lib/pgsql/12/data/postgresql.conf
#localhostのコメントアウトを解除する設定
pg_hba.confの設定
sudo chmod 777 /var/lib/pgsql/12/data/pg_hba.conf
pg_hba.confの設定(続き)
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication all peer
#host replication all 127.0.0.1/32 ident
#host replication all ::1/128 ident
#アクセス権限の再設定
sudo chmod 700 /var/lib/pgsql/12/data
#PostgreSQLの再起動
sudo systemctl restart postgresql-12
#次回ユーザ設定から再開