PostgreSQL官网https://www.postgresql.orgrpm依赖下载链接(可忽略步骤一)https://download.csdn.net/download/u011320682/11647218找一台可以联网的centos7下载yumdownloadonly插件此插件的作用是可以把rpm镜像包下载到系统本地文件中yum install yum-plugin-downloadonly插件安装完成后下载postgresql11所需rpm文件。yum install --downloadonly --downloaddir/root/pgsqlrpm postgresql11-11.5-1PGDG.rhel7.x86_64yum install --downloadonly --downloaddir/root/pgsqlrpm postgresql11-libs-11.5-1PGDG.rhel7.x86_64yum install --downloadonly --downloaddir/root/pgsqlrpm postgresql11-server-11.5-1PGDG.rhel7.x86_64下载完成后cd pgsqlrpm 查看文件是否下载成功将下载文件拷贝至内网centos机器当中依次执行rpm -ivh postgresql11-11.5-1PGDG.rhel7.x86_64rpm -ivh postgresql11-libs-11.5-1PGDG.rhel7.x86_64rpm -ivh postgresql11-server-11.5-1PGDG.rhel7.x86_64执行完以后postgres安装完毕初始化postgres并设置自启动/usr/pgsql-11/bin/postgresql-11-setup initdbsystemctl start postgresql-11systemctl enable postgresql-11.service修改vim /var/lib/pgsql/9.6/data/postgresql.conf找到listen_addresses将其值修改为 *取消listen_addresses 和 port注释修改vim /var/lib/pgsql/9.6/data/pg_hba.conf找到 #IPv4 local connections 添加hosthost all all 127.0.0.1/32 trusthost all all 0.0.0.0/0 md5保存后退出重启postgres服务systemctl restart postgresql-11这时用 navicat等软件链接数据库即可如果navicat提示 5432 端口TCP链接失败请关闭centos7 防火墙或开启5432端口。备注centos7 关闭防火墙systemctl stop firewalld.service #停止firewallsystemctl disable firewalld.service #禁止firewall开机启动