安装postgresql
yum install -y postgresql-server
初始化数据库
postgresql-setup initdb
允许外部访问数据库
nano /var/lib/pgsql/data/postgresql.conf
替换listen_addresses = 'localhost'为listen_addresses = '*'
允许通过密码登录
nano /var/lib/pgsql/data/pg_hba.conf
将ident替换为md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all