centos系统yum安装配置postgresql

http://yum.postgresql.org/repopackages.php

  1. 查找对应系统版本rpm包安装

2.

yum install postgresql95-server postgresql95-contrib
service postgresql-9.5 initdb
chkconfig postgresql-9.5 on  
service postgresql-9.5 start

3.

postgresql默认只允许本机访问,需要远程连接、外网访问,如何配置? 先配置监听地址,修改postgresql .conf

listen_addresses = '*'
  1. 修改pg_hba.conf,配置支持远程连接

    # TYPE  DATABASE        USER            ADDRESS                 METHOD
    local    all      all                md5
    host    all      all  127.0.0.1/32  md5
    host    all      all  ::1/128      	md5
    host    all             all            0.0.0.0/0                  md5