1. Prerequisites:
PostgreSQL 9.6.1 has been installed through source mode and can be run successfully.
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 is 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 is 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 is 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 is 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 is 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 is done for ' install-exec-am '.
MAKE[3]: Nothing to is 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 is 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 is done for ' all-am '.
MAKE[1]: Leaving directory '/home/soft/proj-4.9.3 '
#
# make Install
......
......
MAKE[2]: Nothing to is 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
Bit Jpeg:yes
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. Create an extension
1). Enter database query PostGIS available extensions
postgres=# SELECT name, default_version,installed_version from Pg_available_extensions WHERE name is 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). Add Postgres user 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 system
Create an extension
postgres=# CREATE DATABASE realstate;
postgres=# \c realstate;
Connected to Database "Realstate" as User "Postgres".
realstate=# Create extension PostGIS;
CREATE EXTENSION
8. Verify the extension
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=#
This article is from the "Yiyi" blog, make sure to keep this source http://heyiyi.blog.51cto.com/205455/1873448
Linux Platform PostGIS Installation