美文网首页
centos6x 安装postgresql9.6

centos6x 安装postgresql9.6

作者: 始于初见121 | 来源:发表于2017-05-09 16:42 被阅读0次


    1.yum install https://yum.postgresql.org/9.6/redhat/rhel-7-x86_64/pgdg-redhat96-9.6-3.noarch.rpm

     2.yum install postgresql96-server postgresql96-contrib (or yum groupinstall "PostgreSQL Database Server 9.6 PGDG")

     3.service postgresql-9.6 initdb (初始化)

     4.chkconfig --list (查看系统服务列表,可省略)

    5.chkconfig postgresql-9.6 on service postgresql-9.6 start (设置服务随机器自启)

     6.chkconfig --list (查看系统服务列表,检查设置是否生效)

    7.配置postgresql服务器监听地址和端口号

    vi /var/lib/pgsql/9.6/data/postgresql.conf

    listen_address = '*' (去掉前面的#)

    port = 5432

    注意重启服务后生效。

     8.设置postgresql访问权限

    vi /var/lib/pgsql/9.6/data/pg_hba.conf

    在这一段后边加一句

    host    all            all            127.0.0.1/32            ident

    就是这句:

    host    all            all            0.0.0.0/0              md5

    重启服务:service postgresql-9.6 restart

    9. 修改postgresql默认postgres数据库密码

    ALTER USER postgres WITH PASSWORD 'postgres';(注意最后的分号要带上)

    重启下服务.

     10.查看下防火墙状态,看5432端口放开了没有。如果没有,看下边

    service iptables status(查看状态的命令)

    /sbin/iptables -I INPUT -p tcp --dport 5432 -j ACCEPT  写入修改

    /etc/init.d/iptables save  保存修改

    service iptables restart

    或者直接编辑iptables文件

    vi /etc/sysconfig/iptables

    加上这句话

    -A INPUT -p tcp -m tcp --dport 5432 -j ACCEPT

    重启防火墙,修改生效

    打开navicat就可以连了.

    参考链接

    https://www.postgresql.org/download/linux/redhat/

    http://kabuto-v.iteye.com/blog/2296012

    http://www.thinksaas.cn/topics/0/724/724618.html

    相关文章

      网友评论

          本文标题: centos6x 安装postgresql9.6

          本文链接:https://www.haomeiwen.com/subject/iicitxtx.html