安装过程

一 :所需组件
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.
以上所需组件最好下载源码安装。

二: 环境信息
Postgresql: 9.4.2
Postgis:    2.2
pgrouting: 2.2
OS :  Ubuntu 15.04
查看方法:
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

三: 安装依赖包

--3.1 安装 proj
下载地址: http://trac.osgeo.org/proj/
--简要步骤
# mkdir -p /home/postgres/pg_tool/proj
#./configure --prefix=/home/postgres/pg_tool/proj
#  make
#  make install
 备注:安装过程中没报错,并且 /home/postgres/pg_tool/proj 目录下有文件,说明 proj 安装成功。
 
--3.2 安装 geos
下载地址:  http://trac.osgeo.org/geos/
--简要步骤   
# 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 安装 JSON-C
下载地址: http://oss.metaparadigm.com/json-c/
--简要步骤    
# 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 安装 GDAL
下载地址:http://trac.osgeo.org/gdal/wiki/DownloadSource
--简要步骤  
# mkdir -p /home/postgres/pg_tool/gdal
# ./configure  --prefix=/home/postgres/pg_tool/gdal
# make
# make install  
 
--3.5 安装 libxml2
# sudo apt-get install libxml2-dev
备注:也可以在 http://www.linuxfromscratch.org/blfs/view/svn/general/libxml2.html 下载。

--3.6 安装 postgis-2.2
--3.6.1  .bash_profile 新增以下环境变量
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
备注:编缉完成后,执行.bash_profile 立即生效。

-- 3.6.2 下载  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
备注:执行 configure 之后,如果没报错,会出现以下信息:
如图1

--3.6.4 编译并安装
# make
# make check
# sudo make install (注意需要sudo)

--3.7 安装 pgrouting2.2
下载地址:https://github.com/pgRouting/pgrouting
--简要步骤  
# cd pgrouting
# makedir build
# cd build
# cmake ..
# make
# sudo make install
备注:需要安装依赖的包 libboost-thread-dev,libcgal-dev
详情阅读源码里的README.md
FAQ
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:安装postgis需要启动postgresql,注意把postgresql安装路径配置到path路径下,主要不要使用最新版本的postgresql
Q2:出现如图2所示错误


A2:注意不要安装最新版本的postgresql,最好apt-cache search postgresql
查看一下本系统支持的稳定版本的postgresql,其他如Q1
Q3:-1: error: collect2: ld returned 1 exit status
A3:注意gcc,和g++是否安装,sudo apt-get install build-essential bison libc6-dev
Q4:ERROR:AM_PROG_LIBTOOL command not found
A4:安装libtool包,执行 autoreconf -fvi 注意:最好需要重新生成configure文件,重新make
Q5:还有其他问题
A5:看一下readme.md里依赖的包安装没有,查看出错信息,定位错误原因,然后谷歌搜答案

ubuntu使用postgist,pgrouting的更多相关文章

  1. 路径分析—QGIS+PostgreSQL+PostGIS+pgRouting(一)

    前言 因业务需求,需要做最短路径分析.最近几天查询资料,并自己动手,实现了简单的路径分析. 下面就介绍具体的实现过程. 本篇文章最终结果是在 PostgreSQL 数据库中实现的,后续的可视化展示会继 ...

  2. 关于ubuntu实机与虚机互相copy

    我的开发环境是在ubuntu上的,但是ubuntu上没有官方支持的QQ,有些不太方便,所以在上面虚了一个Win7(先是win10,但是win10最新版本太坑了,不说了),不过经常会出现复制文件,或者文 ...

  3. 在Ubuntu下搭建ASP.NET 5开发环境

    在Ubuntu下搭建ASP.NET 5开发环境 0x00 写在前面的废话 年底这段时间实在太忙了,各种事情都凑在这个时候,没时间去学习自己感兴趣的东西,所以博客也好就没写了.最近工作上有个小功能要做成 ...

  4. Ubuntu 14.04中Elasticsearch集群配置

    Ubuntu 14.04中Elasticsearch集群配置 前言:本文可用于elasticsearch集群搭建参考.细分为elasticsearch.yml配置和系统配置 达到的目的:各台机器配置成 ...

  5. 在Ubuntu 16.10 安装 git 并上传代码至 git.oschina.net

    1. 注册一个账号和创建项目 先在git.oschina.net上注册一个账号和新建一个project ,如project name 是"myTest". 2.安装git sudo ...

  6. 在Ubuntu 16.10安装mysql workbench报未安装软件包 libpng12-0错误

    1.安装mysql workbench,提示未安装软件包 libpng12-0 下载了MySQL Workbench 6.3.8   在安装的时候报错: -1ubu1604-amd64.deb 提示: ...

  7. Ubuntu 16.10 安装KolourPaint 4画图工具

    KolourPaint 4画图工具简单实用,可以绘画.视频处理和图标编辑: • 绘画:绘制图表和“手绘” • 视频处理:编辑截图和照片;应用特效 • 图标编辑:绘画剪贴和标识透明化 1.在Ubuntu ...

  8. 使用ubuntu作为web开发环境的一些感受

    从ms-dos,win95,win98,winMe,winXp,vista,win7,win10我都有使用的经历,我使用时间最长的应属winxp,其次是win7,说实话,我觉得这两个系统是微软做的最好 ...

  9. ubuntu系统下如何修改host

    Ubuntu系统的Hosts只需修改/etc/hosts文件,在目录中还有一个hosts.conf文件,刚开始还以为只需要修改这个就可以了,结果发现是需要修改hosts.修改完之后要重启网络.具体过程 ...

随机推荐

  1. C++内置类型对象之间的转换

    C++定义了一组内置类型对象之间的标准转换,在必要时它们被编译器隐式地应用到对象上. 隐式类型转换发生在下列这些典型情况下. 1. 在混合类型的算数表达式中 规则:在这种情况下最宽的数据类型成为目标转 ...

  2. Penalty

    Penalty时间限制:1000 ms | 内存限制:65535 KB难度:2描述As is known to us, the penalty is vitally important to comp ...

  3. html5 geolocation API

    清单 1. 检查浏览器支持性if (navigator.geolocation) 清单 2. 单次定位请求 API void getCurrentPosition(updateLocation, op ...

  4. django 实现指定文件合并成压缩文件下载

    需求是在一列学生列表中选择指定的学生,然后下载他们上传的报告文档.

  5. MVC-03 控制器(2)

    五.ActionResult解说 ActionResult的继承图: 类型 Controller辅助方法 用途帮助 ContentResult Content 回传一个用户自定义的文字属性 Empty ...

  6. 8,SSO,,eager copy,COW

    针对字符串不同的长度,“编译器”选择不同的优化策略:SSO, eager copy,COW,分别针对短字符串,中等长度字符串,长字符串.不过,现在(2016)的大多数编译器(gcc 4.9.1,vs2 ...

  7. 帝国cms7.2自定义列表建立tag效果 代码 教程

    统计记录:(如:select count(*) as total from phome_ecms_news where classid=1 and checked=1) 注:这句SQL的意思是查找统计 ...

  8. 意大利奢侈品牌-Kiton 华丽进驻北京新光天地-时尚生活-泛高尔夫网

    意大利奢侈品牌-Kiton 华丽进驻北京新光天地-时尚生活-泛高尔夫网 意大利奢侈品牌-Kiton 华丽进驻北京新光天地

  9. mySQL中replace的用法

    MySQL replace函数我们经常用到,下面就为您详细介绍MySQL replace函数的用法,希望对您学习MySQL replace函数方面能有所启迪   mysql replace实例说明: ...

  10. Effective C++ 第二版 10) 写operator delete

    条款10 写了operator new就要同时写operator delete 写operator new和operator delete是为了提高效率; default的operator new和o ...