redhat 7x 安装配置postgres 10

redhat 7.x 安装配置postgresql 10


环境

  • redhat 7.4
  • root账户运行

操作

安装postgres 10

可参考:https://www.postgresql.org/download/linux/redhat

  1. Install the repository RPM:
yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-redhat10-10-2.noarch.rpm
  1. Install the client packages:
yum install postgresql10
  1. Optionally install the server packages:
yum install postgresql10-server
  1. Optionally initialize the database and enable automatic start:
/usr/pgsql-10/bin/postgresql-10-setup initdb
systemctl enable postgresql-10
systemctl start postgresql-10

修改postgres用户密码

su postgres
psql # 进入psql
ALERT USER 'postgres' WITH PASSWORD 'postgres'; # 修改postgres登录密码
\q # 退出psql
exit # 退出postgres

配置postgres 10连接限制

vim /var/lib/pgsql/10/data/pg_hba.conf
  • vim /var/lib/pgsql/10/data/pg_hba.conf 配置部分如下
# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                      trust
# IPv4 local connections:
host    all             all             127.0.0.1/32             trust
# IPv6 local connections:
host    all             all             ::1/128                  trust

总结

至此postgres 10 安装配置完毕,特此记录备忘。

你可能感兴趣的:(redhat 7x 安装配置postgres 10)