zoukankan      html  css  js  c++  java
  • [原]Postgresql 12 Centos8 一键配置脚本

    #!/bin/bash
    echo "write repo"
    sudo cat>/etc/yum.repos.d/pgdg-redhat-12.repo<<EOF
    [pgdg12]
    name=pgdg12
    baseurl=https://mirrors.cnnic.cn/postgresql/repos/yum/12/redhat/rhel-8-x86_64/
    enabled=1
    gpgcheck=0
    EOF
    echo "install postgresql12"
    sudo dnf install postgresql12-server -y --disablerepo=BaseOS --disablerepo=AppStream
    echo "postgresql initdb"
    sudo /usr/pgsql-12/bin/postgresql-12-setup initdb
    echo "postgresql start"
    sudo systemctl enable --now postgresql-12
    echo "postgresql add firewall"
    sudo firewall-cmd --add-service=postgresql --permanent
    sudo firewall-cmd --reload
    echo "postgresql password postgres"
    sudo su - postgres <<<"psql -c "alter user postgres with password 'postgres'""
    echo "postgresql bind *"
    sudo su - postgres <<<"sed -i 's/'"#listen_addresses = 'localhost'"/"listen_addresses = '*'    "'/g' /var/lib/pgsql/12/data/postgresql.conf"
    echo "postgresql allow 0.0.0.0/0"
    sudo su - postgres <<<"echo "host    all             all             0.0.0.0/0               md5">>/var/lib/pgsql/12/data/pg_hba.conf"
    echo "postgresql restart"
    sudo systemctl restart postgresql-12
  • 相关阅读:
    命令行获取当前日期及时间
    Nginx配置性能优化
    一些查看网络连接的命令
    Python 3.5源码编译安装
    Node.js 安装配置
    NFS服务器配置文档
    Linux服务器SSH免密互访
    LVM逻辑卷管理命令
    Zabbix客户端安装
    CentOS 7网卡网桥、绑定设置
  • 原文地址:https://www.cnblogs.com/yzpopulation/p/12250829.html
Copyright © 2011-2022 走看看