参考:https://www.postgresql.org/download/linux/redhat/
- Install the repository RPM:
yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-1.noarch.rpm
- Install the client packages:
yum install postgresql10
- Optionally install the server packages:
yum install postgresql10-server
- Optionally initialize the database and enable automatic start:
/usr/pgsql-10/bin/postgresql-10-setup initdb systemctl enable postgresql-10 systemctl start postgresql-10
修改密码:
su postgrespsqlALTER USER postgres WITH PASSWORD '123456';\qsu root
修改PostgresSQL数据库配置实现远程访问
①、修改postgresql.conf
文件:
vi /var/lib/pgsql/10/data/postgresql.conf
将listen_addresses
前的#
去掉,并将 listen_addresses = 'localhost'
改成 listen_addresses = '*'
;
vi /var/lib/pgsql/10/data/pg_hba.conf
将IPv4区下的127.0.0.1/32
修改为0.0.0.0/0
; 将ident修改为md5
systemctl restart postgresql-10