前端之家收集整理的这篇文章主要介绍了
PsotgreSQL 10 安装 PostGIS 插件,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
# Postgresql 10 安装 PostGIS 插件
#作者:老农民
#QQ: 46715422
#Email: flyingercn@wo.cn
#微信: ericliu_77
# 环境 Debian 9.1 Postgresql 10
wget http://download.osgeo.org/proj/proj-4.9.3.tar.gz
tar xf proj-4.9.3.tar.gz
cd proj-4.9.3/
./configure --prefix=/usr/local/proj
make -j `grep processor /proc/cpuinfo | wc -l`
make install
cd ../
wget http://download.osgeo.org/geos/geos-3.6.2.tar.bz2
tar xf geos-3.6.2.tar.bz2
cd geos-3.6.2/
./configure --prefix=/usr/local/geos
make -j `grep processor /proc/cpuinfo | wc -l`
make install
cd ../
wget ftp://xmlsoft.org/libxml2/libxml2-2.9.6.tar.gz
tar xf libxml2-2.9.6.tar.gz
cd libxml2-2.9.6/
./configure --with-python=/usr/bin/python-config
make -j `grep processor /proc/cpuinfo | wc -l`
make install
cd ../
wget http://ftp.gnu.org/gnu/libiconv/libiconv-1.14.tar.gz
# 访问 https://pan.baidu.com/s/1i5CaQpv 下载 libiconv-glibc-2.16.patch
tar xf libiconv-1.14.tar.gz
patch -d libiconv-1.14 -p0 < libiconv-glibc-2.16.patch
cd libiconv-1.14/
./configure --prefix=/usr/local
make -j `grep processor /proc/cpuinfo | wc -l`
make install
cd ../
wget https://s3.amazonaws.com/json-c_releases/releases/json-c-0.12.1.tar.gz
tar xf json-c-0.12.1.tar.gz
cd json-c-0.12.1/
./configure --prefix=/usr/local/json --disable-static
make -j `grep processor /proc/cpuinfo | wc -l`
make install
cd ../
wget http://download.osgeo.org/gdal/2.2.2/gdal-2.2.2.tar.xz
tar xf gdal-2.2.2.tar.xz
cd gdal-2.2.2/
./configure --prefix=/usr/local/gdal --with-python=/usr/bin/python --with-libiconv-prefix=/usr/local
make -j `grep processor /proc/cpuinfo | wc -l`
make install
cd ../
echo "/usr/local/gdal/lib/" > /etc/ld.so.conf.d/gdal.conf
echo "/usr/local/proj/lib/" > /etc/ld.so.conf.d/proj.conf
echo "/usr/local/json/lib/" > /etc/ld.so.conf.d/json.conf
echo "/usr/local/geos/lib/" > /etc/ld.so.conf.d/geos.conf
/sbin/ldconfig
wget http://download.osgeo.org/postgis/source/postgis-2.4.0.tar.gz
tar xf postgis-2.4.0.tar.gz
cd postgis-2.4.0/
./configure --with-pgconfig=/home/pgsql/bin/pg_config --with-projdir=/usr/local/proj --with-gdalconfig=/usr/local/gdal/bin/gdal-config --with-geosconfig=/usr/local/geos/bin/geos-config --with-jsondir=/usr/local/json --with-xml2config=/usr/local/bin/xml2-config --with-libiconv-prefix=/usr/local --with-gui --with-topology
make -j `grep processor /proc/cpuinfo | wc -l`
make install
cd ../
su -l postgres -s /bin/bash -c "/home/pgsql/bin/psql"
# 检查 PostGIS 安装是否正确
postgres=# select * from pg_available_extensions where name like 'postgis%';
# 为数据库增加 PostGIS 插件
postgres=# CREATE EXTENSION postgis;
postgres=# CREATE EXTENSION postgis_topology;
# 安装客户端插件(不是必须)
postgres=# CREATE EXTENSION adminpack;
原文链接:https://www.f2er.com/postgresql/193537.html