支持在Centos7 环境下进行安装,路径可根据需要进行修改
#!/bin/bash
tar -xvf /opt/postgresql_dir.tar.tgz -C /opt/
rpm -ivh /opt/postgresql_dir/libicu-50.2-4.el7_7.x86_64.rpm
rpm -ivh /opt/postgresql_dir/postgresql10-*
sed -i 's/Environment=PGDATA=\/var\/lib\/pgsql\/10\/data\//Environment=PGDATA=\/opt\/pgsql\/data\//g' /usr/lib/systemd/system/postgresql-10.service
sudo chown -R postgres /opt/pgsql/data
/usr/pgsql-10/bin/postgresql-10-setup initdb
systemctl enable postgresql-10
sed -i 's/local all all peer/local all all trust/g' /opt/pgsql/data/pg_hba.conf
sed -i 's/host all all 127\.0\.0\.1\/32 ident/host all all 127\.0\.0\.1\/32 trust/g' /opt/pgsql/data/pg_hba.conf
systemctl start postgresql-10
如果发生无法启动的情况:
1.请检查postgresql安装权限问题
2.查看pg_hba.conf 中 local 和 host 的权限
3.查看防火墙是否开启端口5432
修改完成后
systemctl restart postgresql-10
下载连接如下