centos7安装postgresql10版本
更新源 PostgreSQL 10
地址:https://yum.postgresql.org/repopackages.php
这里我选择centos7-x86 64 右键 复制链接。
在centos系统中执行
yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm
安装postgresql
先查看postgresql源
yum list | grep postgresql
安装客户包:
yum install postgresql10
安装服务端包:
yum install postgresql10-server
初始化数据库和可用自动开始:
/usr/pgsql-10/bin/postgresql-10-setup initdb
systemctl enable postgresql-10
systemctl start postgresql-10
修改监听和运程连接数据库
//修改/var/lib/pgsql/10/data目录下的pg_hba.conf
cd /var/lib/pgsql/10/data
vi pg_hba.conf
//修改IPv4 一行内容如下:
//# IPv4 local connections:
host all all 0.0.0.0/0 trust
修改postgresql.conf:
vi postgresql.conf
//修改监听一节如下:
//# - Connection Settings -
listen_addresses = ‘*’
port = 5432
重启pg服务生效
systemctl start postgresql-10