美文网首页
Centos7安装配置PostgreSQL9.6.16

Centos7安装配置PostgreSQL9.6.16

作者: 苏米西 | 来源:发表于2019-12-23 17:23 被阅读0次

    一、yum安装

    1、安装yum仓库

    # yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
    

    2、安装client、server

    # yum install postgresql96
    
    # yum install postgresql96-server
    
    # rpm -qa|grep postgresql
    postgresql96-9.6.16-2PGDG.rhel7.x86_64
    postgresql96-libs-9.6.16-2PGDG.rhel7.x86_64
    postgresql96-server-9.6.16-2PGDG.rhel7.x86_64
    

    3、初始化数据库

    # /usr/pgsql-9.6/bin/postgresql96-setup initdb
    # systemctl enable postgresql-9.6
    # systemctl start postgresql-9.6
    

    4、配置

    注意:所有的配置文件修改都需要重启数据库

    4.1、修改用户名密码
    # su - postgres
    -bash-4.2$ psql -U postgres
    postgres=# alter user postgres with password 'postgres'
    
    4.2、允许远程访问
    # vim /var/lib/pgsql/9.6/data/postgresql.conf
    修改#listen_addresses = 'localhost'  为  listen_addresses='*'
    
    4.3、信任远程服务器连接
    # egrep -v "^$|*#" /var/lib/pgsql/9.6/data/pg_hba.conf
    local   all             all                                     peer
    host    all             all             127.0.0.1/32            ident
    host    all             all             192.168.0.0/16          trust
    host    all             all             ::1/128                 ident
    
    4.4、修改数据目录
    # vim /var/lib/pgsql/9.6/data/postgresql.conf
    data_directory = '/app_server/pgdata'
    # mkdir /app_server/pgdata
    # chown postgres postgres /app_server/pgdata
    # chmod 700 /app_server/pgdata
    # systemctl restart postgresql-9.6
    

    二、rpm安装

    # centos7.5
    url: https://yum.postgresql.org/9.6/redhat/rhel-7.5-x86_64/
    # 自行下载安装
    # yum install -y ...
    

    其他步骤如上哟!

    相关文章

      网友评论

          本文标题:Centos7安装配置PostgreSQL9.6.16

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