1、准备工做:
1.postgresql官网:https://www.postgresql.org
2.下载页面:https://www.postgresql.org/download/
3.Red Hat家族Linux(包括CentOS/Fedora/Scientific/Oracle)下载页面:https://www.postgresql.org/download/linux/redhat/
4.本文使用系统为:centos 7.5 1804
5.能够使用一下网址找到对应的postgresql yum安装版本 页面:
https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7-x86_64/pgdg-centos11-11-2.noarch.rpm
2、系统执行命令:
1.yum install -y https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7-x86_64/pgdg-centos11-11-2.noarch.rpmlinux
postgres=# ALTER USER postgres with encrypted password 'welcome1';
ALTER ROLE
postgres=# \q
-bash-4.2$ exit
logout
5、设置远程访问
命令:
vim /var/lib/pgsql/11/data/postgresql.conf
打开后找到:listen_addresses修改成:
listen_addresses = ''
要监听的IP地址;以逗号分隔的地址列表;默认为'localhost';对全部人使用''。修改完毕后保存关闭。sql
命令:
vim /var/lib/pgsql/11/data/pg_hba.conf
打开后文本新增内容以下:
host all all 0.0.0.0/0 md5
修改完成后保存关闭编辑。数据库
六。重启postgres 数据库
systemctl restart postgresql-11vim