Linux 平台PostGIS安装

简介:

1.前提条件:

postgresql 9.6.1 已经通过源码方式安装完成并可成功运行。


2. other OS packets

OS: CentOS 6.4 X64

X64: libxml2-devel


3.geos-3.6.0


http://download.osgeo.org/geos/geos-3.6.0.tar.bz2


# tar xjvf geos-3.6.0.tar.bz2 

./configure

......

......

......

config.status: executing libtool commands

Swig: false

Python bindings: false

Ruby bindings: false

# make

......

......

make[3]: Leaving directory `/home/soft/geos-3.6.0/tests/geostest'

Making all in thread

make[3]: Entering directory `/home/soft/geos-3.6.0/tests/thread'

make[3]: Nothing to be done for `all'.

make[3]: Leaving directory `/home/soft/geos-3.6.0/tests/thread'

make[3]: Entering directory `/home/soft/geos-3.6.0/tests'

make[3]: Nothing to be done for `all-am'.

make[3]: Leaving directory `/home/soft/geos-3.6.0/tests'

make[2]: Leaving directory `/home/soft/geos-3.6.0/tests'

Making all in tools

make[2]: Entering directory `/home/soft/geos-3.6.0/tools'

make[2]: Nothing to be done for `all'.

make[2]: Leaving directory `/home/soft/geos-3.6.0/tools'

make[2]: Entering directory `/home/soft/geos-3.6.0'

make[2]: Nothing to be done for `all-am'.

make[2]: Leaving directory `/home/soft/geos-3.6.0'

make[1]: Leaving directory `/home/soft/geos-3.6.0'

# make install

......

......

Making install in tools

make[2]: Entering directory `/home/soft/geos-3.6.0/tools'

make[3]: Entering directory `/home/soft/geos-3.6.0/tools'

 /bin/mkdir -p '/usr/local/bin'

 /usr/bin/install -c geos-config '/usr/local/bin'

make[3]: Nothing to be done for `install-data-am'.

make[3]: Leaving directory `/home/soft/geos-3.6.0/tools'

make[2]: Leaving directory `/home/soft/geos-3.6.0/tools'

make[2]: Entering directory `/home/soft/geos-3.6.0'

make[3]: Entering directory `/home/soft/geos-3.6.0'

make[3]: Nothing to be done for `install-exec-am'.

make[3]: Nothing to be done for `install-data-am'.

make[3]: Leaving directory `/home/soft/geos-3.6.0'

make[2]: Leaving directory `/home/soft/geos-3.6.0'

make[1]: Leaving directory `/home/soft/geos-3.6.0'


4.proj4


http://download.osgeo.org/proj/proj-4.9.3.tar.gz


# tar zxvf proj-4.9.3.tar.gz

# cd proj-4.9.3

# ./configure

# make

......

......

make[2]: Leaving directory `/home/soft/proj-4.9.3/jniwrap'

make[1]: Leaving directory `/home/soft/proj-4.9.3/jniwrap'

Making all in cmake

make[1]: Entering directory `/home/soft/proj-4.9.3/cmake'

make[1]: Nothing to be done for `all'.

make[1]: Leaving directory `/home/soft/proj-4.9.3/cmake'

make[1]: Entering directory `/home/soft/proj-4.9.3'

make[1]: Nothing to be done for `all-am'.

make[1]: Leaving directory `/home/soft/proj-4.9.3'

#

# make install

......

......

make[2]: Nothing to be done for `install-exec-am'.

 /bin/mkdir -p '/usr/local/lib/pkgconfig'

 /usr/bin/install -c -m 644 proj.pc '/usr/local/lib/pkgconfig'

make[2]: Leaving directory `/home/soft/proj-4.9.3'

make[1]: Leaving directory `/home/soft/proj-4.9.3'





5.gdal


http://download.osgeo.org/gdal/2.1.2/gdal-2.1.2.tar.gz



export LD_LIBRARY_PATH=/opt/pgsql/9.6.1/lib

export PATH=/opt/pgsql/9.6.1/bin:$PATH

export MANPATH=/opt/pgsql/9.6.1/share/man:$MANPATH


# ./configure

......

......


GDAL is now configured for x86_64-pc-linux-gnu


  Installation directory:    /usr/local

  C compiler:                gcc -g -O2

  C++ compiler:              g++ -g -O2


  LIBTOOL support:           yes


  LIBZ support:              external

  LIBLZMA support:           no

  cryptopp support:          no

  GRASS support:             no

  CFITSIO support:           no

  PCRaster support:          internal

  LIBPNG support:            internal

  DDS support:               no

  GTA support:               no

  LIBTIFF support:           internal (BigTIFF=yes)

  LIBGEOTIFF support:        internal

  LIBJPEG support:           internal

  12 bit JPEG:               yes

  12 bit JPEG-in-TIFF:       yes

  LIBGIF support:            internal

  OGDI support:              no

  HDF4 support:              no

  HDF5 support:              no

  Kea support:               no

  NetCDF support:            no

  Kakadu support:            no

  JasPer support:            no

  OpenJPEG support:          no

  ECW support:               no

  MrSID support:             no

  MrSID/MG4 Lidar support:   no

  MSG support:               no

  GRIB support:              yes

  EPSILON support:           no

  WebP support:              no

  cURL support (wms/wcs/...):no

  PostgreSQL support:        yes

  MRF support:               yes

  MySQL support:             no

  Ingres support:            no

  Xerces-C support:          no

  NAS support:               no

  Expat support:             no

  libxml2 support:           yes

  Google libkml support:     no

  ODBC support:              no

  PGeo support:              no

  FGDB support:              no

  MDB support:               no

  PCIDSK support:            internal

  OCI support:               no

  GEORASTER support:         no

  SDE support:               no

  Rasdaman support:          no

  DODS support:              no

  SQLite support:            no

  PCRE support:              yes

  SpatiaLite support:        no

  DWGdirect support          no

  INFORMIX DataBlade support:no

  GEOS support:              yes

  QHull support:             internal

  Poppler support:           no

  Podofo support:            no

  PDFium support:            no

  OpenCL support:            no

  Armadillo support:         no

  FreeXL support:            no

  SOSI support:              no

  MongoDB support:           no



  SWIG Bindings:             no


  Statically link PROJ.4:    no

  enable GNM building:       no

  enable pthread support:    yes

  enable POSIX iconv support:yes

  hide internal symbols:     no


# make

......

......

.so -lpq -lpthread -lrt -ldl -lpcre -lxml2 -lz  -Wl,-rpath -Wl,/usr/local/lib

make[1]: Leaving directory `/home/soft/gdal-2.1.2/apps'

rm -f gdal.pc

echo 'CONFIG_VERSION='`cat ./VERSION`'' >> gdal.pc

echo 'CONFIG_INST_PREFIX=/usr/local' >> gdal.pc

echo 'CONFIG_INST_LIBS=-L/usr/local/lib -lgdal' >> gdal.pc

echo 'CONFIG_INST_CFLAGS=-I/usr/local/include' >> gdal.pc

echo 'CONFIG_INST_DATA=/usr/local/share/gdal/data' >> gdal.pc

cat gdal.pc.in >> gdal.pc

# make install

......

......

make[1]: Leaving directory `/home/soft/gdal-2.1.2/scripts'

for f in LICENSE.TXT data/*.* ; do /home/soft/gdal-2.1.2/install-sh -c -m 0644 $f /usr/local/share/gdal ; done

/bin/sh /home/soft/gdal-2.1.2/libtool --mode=finish --silent /usr/local/lib

/home/soft/gdal-2.1.2/install-sh -d /usr/local/lib/pkgconfig

/home/soft/gdal-2.1.2/install-sh -c -m 0644 gdal.pc /usr/local/lib/pkgconfig/gdal.pc



6.postgis


export LD_LIBRARY_PATH=/opt/pgsql/9.6.1/lib

export PATH=/opt/pgsql/9.6.1/bin:$PATH

export MANPATH=/opt/pgsql/9.6.1/share/man:$MANPATH

# tar zxvf postgis-2.3.0.tar.gz 

# cd postgis-2.3.0

# ./configure

......

......

config.status: executing po-directories commands


  PostGIS is now configured for x86_64-pc-linux-gnu


 -------------- Compiler Info ------------- 

  C compiler:           gcc -g -O2

  SQL preprocessor:     /usr/bin/cpp -traditional-cpp -w -P


 -------------- Dependencies -------------- 

  GEOS config:          /usr/local/bin/geos-config

  GEOS version:         3.6.0

  GDAL config:          /usr/local/bin/gdal-config

  GDAL version:         2.1.2

  PostgreSQL config:    /opt/pgsql/9.6.1/bin/pg_config

  PostgreSQL version:   PostgreSQL 9.6.1

  PROJ4 version:        49

  Libxml2 config:       /usr/bin/xml2-config

  Libxml2 version:      2.7.6

  JSON-C support:       no

  PCRE support:         yes

  PostGIS debug level:  0

  Perl:                 /usr/bin/perl


 --------------- Extensions --------------- 

  PostGIS Raster:       enabled

  PostGIS Topology:     enabled

  SFCGAL support:       disabled

  Address Standardizer support:       enabled


 -------- Documentation Generation -------- 

  xsltproc:             

  xsl style sheets:     

  dblatex:              

  convert:              

  mathml2.dtd:          http://www.w3.org/Math/DTD/mathml2/mathml2.dtd


# make

......

......

mkdir -p sql

cat us_lex.sql us_gaz.sql us_rules.sql sql_bits/address_standardizer_data_us_mark_editable_objects.sql.in > sql/address_standardizer_data_us.sql

mkdir -p sql

cat us_lex.sql us_gaz.sql us_rules.sql sql_bits/address_standardizer_data_us_mark_editable_objects.sql.in > sql/address_standardizer_data_us--2.3.0.sql

cat sql/address_standardizer_data_us--2.3.0.sql > sql/address_standardizer_data_us--2.3.0--2.3.0next.sql

cat sql/address_standardizer_data_us--2.3.0.sql > sql/address_standardizer_data_us--2.3.0next--2.3.0.sql

mkdir -p sql

/usr/bin/cpp -traditional-cpp -w -P -I../libpgcommon test-init-extensions.sql.in | grep -v '^#' | \

        /usr/bin/perl -lpe "s'MODULE_PATHNAME'\$libdir/address_standardizer-2.3'g" > sql/test-init-extensions.sql

mkdir -p sql

/usr/bin/cpp -traditional-cpp -w -P -I../libpgcommon test-parseaddress.sql.in | grep -v '^#' | \

        /usr/bin/perl -lpe "s'MODULE_PATHNAME'\$libdir/address_standardizer-2.3'g" > sql/test-parseaddress.sql

mkdir -p sql

/usr/bin/cpp -traditional-cpp -w -P -I../libpgcommon test-standardize_address_1.sql.in | grep -v '^#' | \

        /usr/bin/perl -lpe "s'MODULE_PATHNAME'\$libdir/address_standardizer-2.3'g" > sql/test-standardize_address_1.sql

mkdir -p sql

/usr/bin/cpp -traditional-cpp -w -P -I../libpgcommon test-standardize_address_2.sql.in | grep -v '^#' | \

        /usr/bin/perl -lpe "s'MODULE_PATHNAME'\$libdir/address_standardizer-2.3'g" > sql/test-standardize_address_2.sql

make[2]: Leaving directory `/home/soft/postgis-2.3.0/extensions/address_standardizer'

make[1]: Leaving directory `/home/soft/postgis-2.3.0/extensions'

PostGIS was built successfully. Ready to install.

# make install

......

...... 

make[2]: Entering directory `/home/soft/postgis-2.3.0/extensions/address_standardizer'

/bin/mkdir -p '/opt/pgsql/9.6.1/lib'

/bin/mkdir -p '/opt/pgsql/9.6.1/share/extension'

/bin/mkdir -p '/opt/pgsql/9.6.1/share/extension'

/bin/mkdir -p '/opt/pgsql/9.6.1/share/doc/extension'

/usr/bin/install -c -m 755  address_standardizer-2.3.so '/opt/pgsql/9.6.1/lib/address_standardizer-2.3.so'

/usr/bin/install -c -m 644 .//address_standardizer.control '/opt/pgsql/9.6.1/share/extension/'

/usr/bin/install -c -m 644 .//address_standardizer_data_us.control .//sql/address_standardizer.sql .//sql/address_standardizer_data_us.sql .//sql/address_standardizer--1.0--2.3.0.sql .//sql/address_standardizer--2.3.0--2.3.0next.sql .//sql/address_standardizer--2.3.0next--2.3.0.sql .//sql/address_standardizer--2.3.0.sql .//sql/address_standardizer_data_us--2.3.0--2.3.0next.sql .//sql/address_standardizer_data_us--2.3.0next--2.3.0.sql .//sql/address_standardizer_data_us--2.3.0.sql  '/opt/pgsql/9.6.1/share/extension/'

/usr/bin/install -c -m 644 .//README.address_standardizer '/opt/pgsql/9.6.1/share/doc/extension/'

make[2]: Leaving directory `/home/soft/postgis-2.3.0/extensions/address_standardizer'

make[1]: Leaving directory `/home/soft/postgis-2.3.0/extensions'


7.创建扩展


1).进入数据库查询postgis可用扩展


postgres=# SELECT name, default_version,installed_version FROM pg_available_extensions WHERE name LIKE 'postgis%' ;

          name          | default_version | installed_version 

------------------------+-----------------+-------------------

 postgis_tiger_geocoder | 2.3.0           | 

 postgis_topology       | 2.3.0           | 

 postgis                | 2.3.0           | 

(3 rows)


postgres=# 


2).添加postgres用户lib PATH

# su - postgres

$ vi .bash_profile 

# .bash_profile


# Get the aliases and functions

if [ -f ~/.bashrc ]; then

        . ~/.bashrc

fi


# User specific environment and startup programs


export LD_LIBRARY_PATH=/usr/local/lib:/opt/pgsql/9.6.1/lib

export PATH=/opt/pgsql/9.6.1/bin:$PATH

export MANPATH=/opt/pgsql/9.6.1/share/man:$MANPATH


3).reboot系统

创建扩展

postgres=# create database realstate;

postgres=# \c realstate ;

You are now connected to database "realstate" as user "postgres".

realstate=# create extension postgis;

CREATE EXTENSION


8.验证扩展

realstate=# \dx

                                     List of installed extensions

  Name   | Version |   Schema   |                             Description                             

---------+---------+------------+---------------------------------------------------------------------

 plpgsql | 1.0     | pg_catalog | PL/pgSQL procedural language

 postgis | 2.3.0   | public     | PostGIS geometry, geography, and raster spatial types and functions

(2 rows)


realstate=#


本文转自 pgmia 51CTO博客,原文链接:http://blog.51cto.com/heyiyi/1873448


相关实践学习
使用PolarDB和ECS搭建门户网站
本场景主要介绍如何基于PolarDB和ECS实现搭建门户网站。
阿里云数据库产品家族及特性
阿里云智能数据库产品团队一直致力于不断健全产品体系,提升产品性能,打磨产品功能,从而帮助客户实现更加极致的弹性能力、具备更强的扩展能力、并利用云设施进一步降低企业成本。以云原生+分布式为核心技术抓手,打造以自研的在线事务型(OLTP)数据库Polar DB和在线分析型(OLAP)数据库Analytic DB为代表的新一代企业级云原生数据库产品体系, 结合NoSQL数据库、数据库生态工具、云原生智能化数据库管控平台,为阿里巴巴经济体以及各个行业的企业客户和开发者提供从公共云到混合云再到私有云的完整解决方案,提供基于云基础设施进行数据从处理、到存储、再到计算与分析的一体化解决方案。本节课带你了解阿里云数据库产品家族及特性。
相关文章
|
11月前
|
Ubuntu Linux
任何Ubuntu用户都应安装的四大Linux应用程序
当然,这款程序不需要太多介绍。我们面对的是网上最庞大最完整的多媒体中心,由于丰富的插件,我们能够高度细化地定制其每一项功能。这是我们的Linux发行版不可或缺的必备软件。 我们可以通过运行以下命令来轻松安装Kodi:sudo apt install kodi。
|
9月前
|
安全 Linux iOS开发
Binary Ninja 5.1.8104 (macOS, Linux, Windows) - 反编译器、反汇编器、调试器和二进制分析平台
Binary Ninja 5.1.8104 (macOS, Linux, Windows) - 反编译器、反汇编器、调试器和二进制分析平台
804 53
Binary Ninja 5.1.8104 (macOS, Linux, Windows) - 反编译器、反汇编器、调试器和二进制分析平台
|
11月前
|
Ubuntu Linux
计算机基础知识:linux系统怎么安装?
在虚拟机软件中创建一个新的虚拟机,并选择相应操作系统类型和硬盘空间大小等参数。将下载的 ISO 镜像文件加载到虚拟机中。启动虚拟机,进入安装界面,并按照步骤进行安装。安装完成后,可以在虚拟机中使用 Linux 系统。
|
11月前
|
Ubuntu 物联网 Linux
从零安装一个Linux操作系统几种方法,以Ubuntu18.04为例
一切就绪后,我们就可以安装操作系统了。当系统通过优盘引导起来之后,我们就可以看到跟虚拟机中一样的安装向导了。之后,大家按照虚拟机中的顺序安装即可。 好了,今天主要介绍了Ubuntu Server版操作系统的安装过程,关于如何使用该操作系统,及操作系统更深层的原理,还请关注本号及相关圈子。
|
11月前
|
Ubuntu Linux 网络安全
Linux服务器之Ubuntu的安装与配置
Ubuntu Desktop是目前最成功、最流行的图形界面的Linux发行版;而Ubuntu Server也在服务器端市场占据了较大的份额。今天为大家详细介绍了Ubuntu Server的安装与配置,希望对你能有所帮助。关于VMware、VirtualBox等虚拟化软件的使用,朱哥还会在后续的文章中为大家详细介绍,敬请关注!
|
9月前
|
安全 Linux iOS开发
Nessus Professional 10.10 Auto Installer for RHEL 10, AlmaLinux 10, Rocky Linux 10 - Nessus 自动化安装程序
Nessus Professional 10.10 Auto Installer for RHEL 10, AlmaLinux 10, Rocky Linux 10 - Nessus 自动化安装程序
634 6
Nessus Professional 10.10 Auto Installer for RHEL 10, AlmaLinux 10, Rocky Linux 10 - Nessus 自动化安装程序
|
9月前
|
Linux API iOS开发
Binary Ninja 4.2.6455 (macOS, Linux, Windows) - 反编译器、反汇编器、调试器和二进制分析平台
Binary Ninja 4.2.6455 (macOS, Linux, Windows) - 反编译器、反汇编器、调试器和二进制分析平台
709 14
Binary Ninja 4.2.6455 (macOS, Linux, Windows) - 反编译器、反汇编器、调试器和二进制分析平台
|
10月前
|
SQL Linux 调度
Timeplus Enterprise 3.0 (Linux, macOS) - 流处理平台
Timeplus Enterprise 3.0 (Linux, macOS) - 流处理平台
216 2
Timeplus Enterprise 3.0 (Linux, macOS) - 流处理平台
|
9月前
|
消息中间件 Kafka Linux
Linux下安装Kafka 3.9.1
本文介绍Kafka 3.9.1版本的安装与配置,包括通过ZooKeeper或KRaft模式启动Kafka。涵盖环境变量设置、日志路径修改、集群UUID生成、存储格式化及服务启停操作,适用于Linux环境下的部署实践。
1215 0
|
11月前
|
网络协议 关系型数据库 Linux
【App Service Linux】在Linux App Service中安装 tcpdump 并抓取网络包
在App Service for Linux环境中,无法像Windows一样直接使用网络排查工具抓包。本文介绍了如何通过TCPDUMP在Linux环境下抓取网络包,包括SSH进入容器、安装tcpdump、执行抓包命令及下载分析文件的完整操作步骤。
517 5