Ubuntu Installation postgist,pgrouting

Source: Internet
Author: User
Tags postgresql postgis

installation Process

One: Required Components
1 PostgreSQL 9.4 or higher.
2 Proj4. Reprojection Library.
3 GEOS. Geometry Library.
4 LibXML2. LibXML2 is currently used in some imports functions
5 json-c. Json-c is currently used to import GeoJSON via the function St_geomfromgeojson.
6 GDAL.
The above required components are best to download the source installation.

II: Environmental Information
postgresql:9.4.2
postgis:2.2
pgrouting:2.2
Os:ubuntu 15.04
To view the method:
routedb_test=# select Postgis_version ();
Postgis_version
---------------------------------------
2.2 Use_geos=1 Use_proj=1 Use_stats=1
(1 row)

routedb_test=# select Postgis_version ();
Postgis_version
---------------------------------------
2.2 Use_geos=1 Use_proj=1 Use_stats=1
(1 row)

Cat/etc/issue

Ubuntu 15.04

Three: Install dependent packages

--3.1 installation proj
: http://trac.osgeo.org/proj/
--Brief steps
# mkdir-p/home/postgres/pg_tool/proj
#./configure--prefix=/home/postgres/pg_tool/proj
# make
# make Install
Note: The installation process did not error, and the/home/postgres/pg_tool/proj directory has a file, indicating Proj installation success.

--3.2 Installation GeoS
: http://trac.osgeo.org/geos/
--Brief steps
# mkdir-p/home/postgres/pg_tool/geos
#./configure--prefix=/home/postgres/pg_tool/geos--enable-python--enable-ruby
# make
# Make Check
# make Install

--3.3 installation Json-c
: http://oss.metaparadigm.com/json-c/
--Brief steps
# wget http://oss.metaparadigm.com/json-c/json-c-0.9.tar.gz
# mkdir-p/home/postgres/pg_tool/json
# sh autogen.sh
#./configure--prefix=/home/postgres/pg_tool/json
# make
# make Install

--3.4 installation GDAL
: Http://trac.osgeo.org/gdal/wiki/DownloadSource
--Brief steps
# mkdir-p/home/postgres/pg_tool/gdal
#./configure--prefix=/home/postgres/pg_tool/gdal
# make
# make Install

--3.5 installation LIBXML2
# sudo apt-get install Libxml2-dev
Note: You can also download it in http://www.linuxfromscratch.org/blfs/view/svn/general/libxml2.html.

--3.6 installation postgis-2.2
--3.6.1. Bash_profile Add the following environment variables
Export Proj_home=/home/postgres/pg_tool/proj
Export Geos_home=/home/postgres/pg_tool/geos
Export Gdal_home=/home/postgres/pg_tool/gdal
Export Json_home=/home/postgres/pg_tool/json
Export ld_library_path= $GDAL _home/lib: $JSON _home/lib: $PROJ _home/lib: $GEOS _home/lib
Note: After editing is complete, execute the. Bash_profile immediately.

--3.6.2 Download postgis-2.2
: http://postgis.refractions.net/download/

--3.6.3 Configure
#./configure--with-pgconfig=/opt/pgsql9.2.3/bin/pg_config--with-projdir=/home/postgres/pg_tool/proj-- With-geosconfig=/home/postgres/pg_tool/geos/bin/geos-config--with-gdalconfig=/home/postgres/pg_tool/gdal/bin/ Gdal-config--with-jsondir=/home/postgres/pg_tool/json
Note: After executing configure, if no error occurs, the following message appears:
1


--3.6.4 Compiling and installing
# make
# Make Check
# sudo make install (note that sudo is required)

--3.7 installation pgrouting2.2
: https://github.com/pgRouting/pgrouting
--Brief steps
# CD Pgrouting
# MakeDir Build
# CD Build
# CMake.
# make
# sudo make install
Note: You need to install a dependent package Libboost-thread-dev,libcgal-dev
Read more about README.MD in the source code
FAQs
Q1: Create extension PostGIS
Error:could not load Library "/home/postgres/pg/pgsql/lib/postgis-2.2.so": Libproj.so.9:cannot Open Shared Object file: No such file or directory
A1: Install PostGIS need to start PostgreSQL, be careful to configure the PostgreSQL installation path to the path path, mainly do not use the latest version of PostgreSQL
Q2: Error 2 appears


A2: Be careful not to install the latest version of PostgreSQL, preferably Apt-cache search PostgreSQL
Check out the stable version of PostgreSQL supported by this system, other such as Q1
Q3: -1:error:collect2:ld returned 1 exit status
A3: Note that gcc, and g++ are installed, sudo apt-get install build-essential bison Libc6-dev
Q4: error:am_prog_libtool command not found
A4: Install Libtool package, perform AUTORECONF-FVI Note: It is best to regenerate the Configure file, re-make
Q5: There are other questions.
A5: Look at the readme.md dependencies on the package installed No, check the error message, locate the cause of the error, and then Google search answers

Ubuntu Installation postgist,pgrouting

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.