CentOS8安装PostgreSQL 12(详细图文教程)

官网教程
安装步骤
# Install the repository RPM:
sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm

# Disable the built-in PostgreSQL module:
sudo dnf -qy module disable postgresql

# Install PostgreSQL:
sudo dnf install -y postgresql12-server

# Optionally initialize the database and enable automatic start:
sudo /usr/pgsql-12/bin/postgresql-12-setup initdb
sudo systemctl enable postgresql-12
sudo systemctl start postgresql-12
开启远程访问
  • 查找postgresql.conf文件

    • find -name postgresql.conf
      
  • vim编辑文件

    • vim ./var/lib/pgsql/12/data/postgresql.conf
      
  • 修改listen_addresses*

    • 在这里插入图片描述
  • 查找pg_hba.conf文件

    • find -name pg_hba.conf
      
  • vim编辑文件

    • vim ./var/lib/pgsql/12/data/pg_hba.conf
      
  • # IPv4 local connections:后追加内容外网访问配置

    • host   all   all   0.0.0.0/0   md5 #允许外网访问,,密码md5加密
      
    • 在这里插入图片描述

  • 防火墙开放5432端口

    • 开放端口

      • firewall-cmd --zone=public --add-port=5432/tcp --permanent
        
    • 配置立即生效

      • firewall-cmd --reload 
        
    • 查看端口是否开启成功

      • firewall-cmd --query-port=5432/tcp
        
  • Navicat连接测试

    • 在这里插入图片描述
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值