https://blog.csdn.net/bcabc123/article/details/83785545
postpresql+postgis交流QQ群:642773979
说明:
在使用编译方式安装postgresql 10.5和postgis过程中,发现编译较慢,特别是安装postgis的gdal插件时,虚拟机里编译了差不多1个小时,很折腾。最后找到这种在线安装的方式,总算解脱了,分分钟搞定。
安装前:
安装环境:CentOS-7-x86_64-Minimal-1804
其他设置:
禁用防火墙:systemctl disable firewalld
禁用selinux:
修改/etc/selinux/config 文件将SELINUX=enforcing改为SELINUX=disabled重启机器即可
7、postgis安装
1)、安装postgis软件
yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm
yum install -y https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm
yum install -y postgis24_10.x86_64
2)、为pgsql安装postgis扩展
重启数据库
su - postgres && cd ~
pg_ctl restart -D /data/pgsql
连接数据库
psql -h localhost -U postgres
安装postgis扩展
postgres=# CREATE EXTENSION postgis;
CREATE EXTENSION
postgres=# CREATE EXTENSION postgis_topology;
CREATE EXTENSION
postgres=# CREATE EXTENSION postgis_sfcgal;
CREATE EXTENSION
postgres=# CREATE EXTENSION fuzzystrmatch;
CREATE EXTENSION
postgres=# CREATE EXTENSION address_standardizer;
CREATE EXTENSION
postgres=#
验证扩展安装情况
postgres=# SELECT postgis_full_version();
未报错则安装成功,否则报错:
ERROR: function postgis_full_version() does not exist
至此,postgis安装完成,可以在pgsql进行相关操作。