zoukankan      html  css  js  c++  java
  • Postgresql 编译安装教程

    1.下载postgresql安装包和依赖包
        依赖包包括:gcc、zlib、readline等

    yum install -y zlib-devel gcc readline readline-devel

     postgresql包下载地址:

    https://ftp.postgresql.org/pub/source/

     readline包下载地址:

    http://ftp.gnu.org/gnu/readline/

    2.安装posgresql

    tar xjvf postgresql*.bz2  或者  tar -zxvf postgresql*.gz
    cd potgresql-12.2

    ./configure --prefix=/opt/pgsql
    make
    make install

    增加postgres用户
    adduser postgres

    设置postgres用户密码
    passwd postgres

    创建数据库目录,并赋予postgres用户权限
    mkdir
    /opt/pgsql/data
    chown
    -R postgres:postgres /opt/pgsql/data

    切换到postgres用户
    su – postgres

    初始化数据库
    /opt/pgsql/bin/initdb -D /opt/pgsql/data

    启动数据库
    /opt/pgsql/bin/pg_ctl -D /opt/pgsql/data -l logfile start

    创建数据库
    /opt/pgsql/bin/created xwgh

    进入数据库
    /opt/pgsql/bin/psql xwgh

    修改默认postgres数据库用户的密码
    xwgh
    =# ALTER USER postgres WITH PASSWORD 'postgres';

    3.配置远程访问posgresql权限

    切换到postgres用户
    su – postgres
    
    修改pg_hba.conf文件,在ipv4 的连接配置处,增加配置
    
    vim /opt/pgsql/data/pg_hba.conf
    
    host    all             all             0.0.0.0/0            password
    
             
    
    修改postgresql.conf文件,在Connection Settings的配置处,增加配置
    
    vim /opt/pgsql/data/postgresql.conf
    
    listen_addresses = '*'
    
             
    
    重启postgresql
    
    /opt/pgsql/bin/pg_ctl -D /opt/pgsql/data -l logfile restart


             

    欢迎关注微信公众号:大数据从业者
  • 相关阅读:
    微信公众号接口配置
    OFBIZ:启动之ContainerLoader
    OFBIZ:启动之StartupLoader
    Capture a Screen Shot
    在 Windows 上安装Rabbit MQ 指南
    Quartz.NET管理周期性任务
    使用Topshelf创建Windows服务
    Redirecting Console.WriteLine() to Textbox
    Greenplum 备忘
    CockroachDB 备忘
  • 原文地址:https://www.cnblogs.com/felixzh/p/14524187.html
Copyright © 2011-2022 走看看