0 、首先确定一下安装版本,看一下插件与数据库互相支持情况
https://trac.osgeo.org/postgis/wiki/UsersWikiPostgreSQLPostGIS

图上显示我写该文章时,postgresql12已经测试版出来了,选择最新但稳定版就是postgresql11。
在服务器上,也可以查看不同版本postgresql对应能安装的postgis版本
yum list postgis*

我已经安装了postgresql11,可选的postgis版本上图已经列出
postgis安装参考官网教程(postgresql9.5+postgis2_95)
http://www.postgresonline.com/article_pfriendly/362.html
1 开始安装postgis插件之前,因为插件中有依赖的内容,需要先安装。
yum -y install epel-release
epel存储地址 :https://dl.fedoraproject.org/pub/epel/
2 进行对应版本的postgis安装
yum install postgis25_11
yum install postgis25_11-client


3 postgis扩展安装完成后的启用步骤如下
3.1 进入数据库用户下,创建gistest数据库并连接
su postgres
/usr/pgsql-11/bin/psql -p 5432
CREATE DATABASE gistest;
\connect gistest;

3.2 创建扩展并查询版本验证安装是否成功
CREATE EXTENSION postgis;
SELECT postgis_full_version();

官网安装参考:
http://www.postgresonline.com/article_pfriendly/362.html
网友评论