Centos7操作系统下的postgresql下载

https://www.postgresql.org/download/linux/redhat/
sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
sudo yum install -y postgresql13-server
sudo /usr/pgsql-13/bin/postgresql-13-setup initdb
sudo systemctl enable postgresql-13
sudo systemctl start postgresql-13

查看当前系统哪些进程正在监听TCP端口5432

netstat -tnlp | grep 5432

下载安装postgis扩展

首先我们在yum源里面查看可用的postgisab

yum list | grep postgis*

红色的部分是 postgis 的版本 (在写这篇博客的时候postgis的最高版本为3.3),蓝色的框 是postgresql的版本号,大家选择自己对应的版本安装

例如我需要安装 postgresql 版本为13的,postgis版本为 3.3的postgis扩展,

然后我们执行

yum install postgis33_14.x86_64

就可以完成postgis的安装!

安装postgis扩展

进入postgresql执行下面语句,安装所有的postgis的驱动

set postgis.gdal_enabled_drivers ='ENABLE_ALL';
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;
CREATE EXTENSION postgis_raster;

有些文章会漏了这两个,加上就好了。

set postgis.gdal_enabled_drivers ='ENABLE_ALL';
CREATE EXTENSION postgis;

原文链接:https://www.kuazhi.com/post/584011.html


 您阅读本篇文章共花了: