0、# 安装官方yum仓库源
yum -y install epel-release
yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
yum search postgresql
1、查看可用的postgres源:
yum list|grep postgresql13
2、选择安装postgresql13:
yum install -y postgresql13-server postgresql13-contrib
3、初始化数据库
/usr/pgsql-13/bin/postgresql-13-setup initdb
4、设置开机启动
systemctl enable postgresql-13
5、启动数据库
systemctl start postgresql-13
6、安装拓展工具
yum install ogr_fdw10 -y
yum install pgrouting_10 -y
7、启动数据库
su postgres
psql
8、创建数据库postgis
yum install -y postgis30_13
CREATE DATABASE postgis OWNER postgres;
切换新创建的database
\c postgis
安装PostGis扩展
postgis=# CREATE EXTENSION postgis;
postgis=# CREATE EXTENSION postgis_topology;
postgis=# CREATE EXTENSION ogr_fdw;
然后可以验证是否安装成功
SELECT postgis_full_version();