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 安装配置完毕,特此记录备忘。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容