码迷,mamicode.com
首页 > 数据库 > 详细

[原]Postgresql 12 Centos8 一键配置脚本

时间:2020-02-02 01:45:28      阅读:237      评论:0      收藏:0      [点我收藏+]

标签:col   sql   baseurl   lis   pps   ESS   code   check   style   

#!/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

 

[原]Postgresql 12 Centos8 一键配置脚本

标签:col   sql   baseurl   lis   pps   ESS   code   check   style   

原文地址:https://www.cnblogs.com/yzpopulation/p/12250829.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!