postgresql的linux在线安装请参考:https://www.postgresql.org/download/linux/redhat/
postgresql离线的安装:
安装好postgresql后,编辑配置文件/var/lib/pgsql/11/data/postgresql.conf,去掉listen_address=‘localhost‘前的# port前的#或者是添加下面的代码:
# *表示监听所有的ip信息,也可以使用localhost、127.0.0.1等
listen_address = '*'
# 默认的监听端口为5432,也可以换为其它的地址
port = 5432
max_connections = 1000
默认情况下,是不允许其它服务器访问的,此时,需要添加ip访问策略。ip的访问控制在pg_hba.conf文件中(pg_hba.conf和postgresql.conf在同一目录下)
#允许所有的服务器通过账号密码访问
# TYPE DATABASE USER ADDRESS METHOD
host all all 0.0.0.0/0 md5
#指定ip访问
host all all 34.56.34.64/32 md5
#ip段访问
host all all 34.56.34.0/24 md5
重启postgres服务:systemctl restart postgresql-9.4
关闭psotgres服务:systemctl stop postgresql-9.4
重新加载配置文件:service postgresql-9.4 reload
要在psotgresql中使用uuid等功能时,需要先安装postgresql94-contrib 如果要使用gis等需要安装对应的插件
原文:https://www.cnblogs.com/zp900704/p/11476976.html