PostgreSQL 之 yum安装 postgis 插件

版本说明:

CentOS7.5 + PostgreSQL 10.5

参考资源:

https://www.postgresql.org/download/linux/redhat/ 

安装postgresql

#Install the repository RPM
yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm

#Install the client packages
yum install postgresql10

#Optionally install the server packages
yum install postgresql10-server

#Optionally initialize the database and enable automatic start
/usr/pgsql-10/bin/postgresql-10-setup initdb
systemctl enable postgresql-10
systemctl start postgresql-10

Which version of PostgreSQL you get will depend on the version of the distribution:
 

安装PostGIS

1.先安装几个工具包

yum install wget net-tools epel-release -y

然后安装postgis

yum install postgis24_10 postgis24_10-client -y

安装拓展工具

yum install ogr_fdw10 -y
yum install pgrouting_10 -y

2.创建数据库postgis

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();

另外,下面是官方网站点列的一份扩展:

-- Enable PostGIS (includes raster)
CREATE EXTENSION postgis;
-- Enable Topology
CREATE EXTENSION postgis_topology;
-- Enable PostGIS Advanced 3D
-- and other geoprocessing algorithms
-- sfcgal not available with all distributions
CREATE EXTENSION postgis_sfcgal;
-- fuzzy matching needed for Tiger
CREATE EXTENSION fuzzystrmatch;
-- rule based standardizer
CREATE EXTENSION address_standardizer;
-- example rule data set
CREATE EXTENSION address_standardizer_data_us;
-- Enable US Tiger Geocoder
CREATE EXTENSION postgis_tiger_geocoder;

  

猜你喜欢

转载自www.cnblogs.com/EikiXu/p/9843904.html