PostGIS安装指南

·安装环境准备

-操作系统:CentOS7.4
-PostgreSql版本:9.6
-PostGIS版本:2.4
-以下命令如不强调,均在root用户下执行

·安装过程

1.添加PostgreSql9.6安装源
rpm -ivh https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm

2.使用yum命令安装PostgreSql
yum install postgresql96 postgresql96-server postgresql96-libs postgresql96-contrib postgresql96-devel

3.初始化PostgreSql数据库
/usr/pgsql-9.6/bin/postgresql96-setup initdb
4.开启PostgreSql数据库并查看当前状态
systemctl start postgresql-9.6.service
systemctl list-unit-files
5.安装PostgreSql扩展包adminpack
su postgres
cd ~/
/usr/pgsql-9.6/bin/psql -p 5432 -c "CREATE EXTENSION adminpack;"
6.添加epel-release源
yum -y install epel-release
7.安装postGIS与postGIS_Client
yum install -y postgis2_96 postgis2_96-client
8.安装ogr_fdw
yum install ogr_fdw96 -y
9.安装pgRouting
yum install -y pgrouting_96
10.开启postgresql数据库的GIS扩展
su postgres
/usr/pgsql-9.6/bin/psql -p 5432
CREATE DATABASE gistest;
\connect gistest;

CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;
CREATE EXTENSION ogr_fdw;
11.验证postGIS安装,在psql中执行
SELECT postgis_full_version();
12.启动pgrouting扩展并验证,在psql中执行
CREATE EXTENSION pgrouting;
SELECT * FROM pgr_version();

转载自:https://blog.csdn.net/weixin_34268169/article/details/87275199

You may also like...