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


             

    欢迎关注微信公众号:大数据从业者
  • 相关阅读:
    Oracle 集合类型
    JAVA_SE_笔记整理(反射机制)
    JAVA_SE_笔记整理(GUI)
    JAVA_SE_笔记整理(网络编程)
    JAVA_SE_笔记整理(多线程)
    JAVA_SE_笔记整理(流)
    JAVA_SE_笔记整理(集合三)
    JAVA_SE_笔记整理(集合二)
    JAVA_SE_笔记整理(集合一)
    JAVA_SE_笔记整理(面向对象四(接口,包,内部类))
  • 原文地址:https://www.cnblogs.com/felixzh/p/14524187.html
Copyright © 2011-2022 走看看