• 用RPM包安装postgresql


    1. 配置yum源

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

     

    2. 安装

    -- 安装11版本
    yum -y install postgresql11-server
    yum -y install postgresql11-devel

    3. 初始化

    -- rhel6
     service postgresql initdb
     chkconfig postgresql on
     
    -- rhel7/8
    # 修改数据目录路径
    vi /usr/lib/systemd/system/postgresql-11.service
    Environment=PGDATA=/var/lib/pgsql/11/data/      >>>>>>>配置自定义数据目录 Environment=PGDATA=/ups/data/pgdata/11/pg_root
    /usr/pgsql-11/bin/postgresql-11-setup initdb 
    
    or
    su - postgres
    /usr/pgsql-11/bin/initdb -D /ups/data/pgdata/11/pg_root
     systemctl enable postgresql-11 systemctl start postgresql-11

    4. 启动服务

    -- rhel6
    service postgresql start
    
    -- rhel7/8
    systemctl start postgresql11

    5. 其它相关配置

    -- 配置环境变量
    vi /home/postgres/.bash_profile
    export PGPORT=1921
    export PGUSER=postgres
    export PGGROUP=postgres
    export PGDATA=/ups/data/pgdata/11/pg_root
    export LANG=en_US.UTF-8
    export PGHOME=/ups/app/pgsql-11
    export LD_LIBRARY_PATH=$PGHOME/lib:/lib64:/usr/lib64:/usr/local/lib64:/lib:/usr/lib:/usr/local/lib
    export PATH=$PGHOME/bin:$PATH:.
    export MANPATH=$PGHOME/share/man:$MANPATH
    
    -- 配置IP和端口
    vi ${PGDATA}/postgresql.conf
    -- 修改listen_addresses如下
    listen_addresses = '*'
    
    -- 配置连接方式
    cp ${PGDATA}/pg_hba.conf ${PGDATA}/pg_hba.conf_${MDATE}
    vi ${PGDATA}/pg_hba.conf
    host    all             all             192.168.10.0/24           md5
    
    -- 配置共享内存
    vi ${PGDATA}/postgresql.conf
    shared_buffers = 128MB            # min 128kB      <<<<<<<<默认值
  • 相关阅读:
    进程与线程的区别
    开启线程的两种方式
    线程
    生产者消费者模型(重要)
    队列
    互斥锁
    守护进程(了解)
    Process对象的其它方法与属性(join)
    僵尸进程与孤儿进程
    Servlet
  • 原文地址:https://www.cnblogs.com/binliubiao/p/11743176.html
Copyright © 2020-2023  润新知