alt

运行如下安装指令

yum install postgresql  
yum install postgresql-server  
yum install postgresql-contrib  
yum update  
postgresql-setup initdb  
systemctl enable postgresql.service  
systemctl start postgresql.service

修改数据库登录密码

sudo su - postgres  
psql   
alter user postgres with password 'xxxx';  

允许远程访问【危险操作】

vi /var/lib/pgsql/data/pg_hba.conf  
host	all	all	0.0.0.0/0	trust 

vi /var/lib/pgsql/data/postgresql.conf  
listen_address = '*'

systemctl restart postgresql.service

配置防火墙

firewall-cmd --permanent --zone=public --add-port=5432/tcp    增加规则  
firewall-cmd --permanent --zone=public --remove-port=5432/tcp  删除规则  
firewall-cmd --reload