# Centos7安装PostgreSQL
# PostgreSQL官网
https://www.postgresql.org/download/linux/redhat/
# 安装命令
# 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 postgresql12-server
# Optionally initialize the database and enable automatic start:
sudo /usr/pgsql-12/bin/postgresql-12-setup initdb
sudo systemctl enable postgresql-12
sudo systemctl start postgresql-12
# 更新配置
su postgres
cd
ls
cd 12
cd data
# 更新远程连接策略
vim pg_hba.conf
host all all 0.0.0.0/0 md5
# 更新远程连接配置
vim postgresql.conf
listen_addresses = '*'
# 更新密码
# 修改密码
su postgres
psql
\passwrod
# 连接
su postgres
psql