centos安装pg数据库

发布时间 2023-12-22 15:25:16作者: 潇潇暮鱼鱼

 

1.下载yum源
yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
2.安装libzstd
否则安装数据库报错Requires: libzstd.so.1()(64bit)
yum install -y wget
wget https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/l/libzstd-1.5.5-1.el7.x86_64.rpm
yum install -y libzstd-1.5.5-1.el7.x86_64.rpm
3.安装数据库
yum install -y postgresql15-server
4.安装插件
rpm -ivh https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-14.noarch.rpm &&
yum install -y postgis33_15.x86_64
yum install -y pgrouting_15.x86_64
yum install -y gdal34.x86_64 && yum install -y gdal34-python3.x86_64
4.初始化
sudo /usr/pgsql-15/bin/postgresql-15-setup initdb
sudo systemctl enable postgresql-15
sudo systemctl start postgresql-15