更新
This commit is contained in:
parent
312d32e256
commit
91cb7eb3a5
@ -109,18 +109,18 @@ select host in ${Hostname[@]}; do
|
|||||||
'安装postgres数据库')
|
'安装postgres数据库')
|
||||||
sudo apt-get update && sudo apt-get upgrade
|
sudo apt-get update && sudo apt-get upgrade
|
||||||
echo -e "------默认安装当前最新稳定版本------\n"
|
echo -e "------默认安装当前最新稳定版本------\n"
|
||||||
apt-get install postgresql # 默认安装当前最新稳定版本
|
sudo apt-get install postgresql # 默认安装当前最新稳定版本
|
||||||
systemctl enable postgresql
|
sudo systemctl enable postgresql
|
||||||
echo -e "------查看版本号------\n"
|
echo -e "------查看版本号------\n"
|
||||||
psql --version
|
psql --version
|
||||||
echo -e "------开启Postgres的远程访问------\n"
|
echo -e "------开启Postgres的远程访问------\n"
|
||||||
ver=$(psql --version | grep -oP '\d+' | head -1)
|
ver=$(psql --version | grep -oP '\d+' | head -1)
|
||||||
sed -i '/listen_addresses =/s/=.*/= '\''*'\''/' /etc/postgresql/$ver/main/postgresql.conf
|
sudo sed -i '/listen_addresses =/s/=.*/= '\''*'\''/' /etc/postgresql/$ver/main/postgresql.conf
|
||||||
sed -i '/port =/s/=.*/= '\''5432'\''/' /etc/postgresql/$ver/main/postgresql.conf
|
sudo sed -i '/port =/s/=.*/= '\''5432'\''/' /etc/postgresql/$ver/main/postgresql.conf
|
||||||
echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/$ver/main/pg_hba.conf
|
echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/$ver/main/pg_hba.conf
|
||||||
echo -e "------开启Postgres的远程访问完成------\n"
|
echo -e "------开启Postgres的远程访问完成------\n"
|
||||||
echo -e "------重启psql------\n"
|
echo -e "------重启psql------\n"
|
||||||
systemctl restart postgresql
|
sudo systemctl restart postgresql
|
||||||
echo -e "------设置默认的PostgreSQL用户密码------\n"
|
echo -e "------设置默认的PostgreSQL用户密码------\n"
|
||||||
echo -e "1. 打开终端并以root用户身份登录\n"
|
echo -e "1. 打开终端并以root用户身份登录\n"
|
||||||
echo -e "2. 切换到PostgreSQL默认用户postgres:su - postgres\n"
|
echo -e "2. 切换到PostgreSQL默认用户postgres:su - postgres\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user