CentOS 7 离线、安装、配置 PostgreSQL 9.5及PostGIS2.2(下)

1.安装postgis##

下载源码

安装 proj

tar  -xf   proj-4.9.1.tar.gz

./configure  --prefix=/usr/local/proj

make

make install

安装 libxml2

tar  -xf   libxml2-2.6.0.tar.gz

./configure  --prefix=/usr/local/libxml2

make

make install

安装 geos

tar  -xf   geos-3.5.1.tar.bz2

./configure  --prefix=/usr/local/geos

make

make install

安装 gdal

tar  -xf   gdal-1.10.0.tar.gz

./configure  --prefix=/usr/local/gdal

make

make install

安装 postgis

tar  -xf   postgis-2.2.8dev.tar.gz

/configure  --with-pgconfig=/usr/local/postgresql/bin/pg_config 
	--with-xml2config=/usr/local/libxml2/bin/xml2-config  
	--with-geosconfig=/usr/local/geos/bin/geos-config 
	--with-projdir=/usr/local/proj   
	--with-gdalconfig=/usr/local/gdal/bin/gdal-config
	
make

make install

执行configure 命令时报:
CentOS 7 离线、安装、配置 PostgreSQL 9.5及PostGIS2.2(下)_第1张图片
解决方案:
在/etc/ld.so.conf 中新增PostgreSQL的lib目录(/postgresql/lib)和GDAL的lib文件目录,如下如所示
CentOS 7 离线、安装、配置 PostgreSQL 9.5及PostGIS2.2(下)_第2张图片
检查是否安装成功

psql -d postgres     //其中postgres   为数据库名称

 CREATE EXTENSION postgis;      //在psql 执行 
chown postgresql  /usr/local/gdal/liblibgdal.so.1

cp /usr/local/gdal/lib/libgdal.so.1  /usr/local/postgresql/lib

chown postgresql  /usr/local/geos/lib/libgdal.so.1

cp /usr/local/geos/lib/libgeos_c.so.1  /usr/local/postgresql/lib
 
chown sysadm /usr/local/proj/lib/libproj.so.9
 
cp /usr/local/proj/lib/libproj.so.9  /usr/local/postgresql/lib

你可能感兴趣的:(centos7,postgresql,postgis)