Advertisement
lightxx

Install Postgres 9.1, PostGIS 2.0 and PG Routing on Ubuntu

Mar 8th, 2013
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.97 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # Install Postgres 9.1, PostGIS 2.0 and pgRouting on a clean Ubuntu 12.04 install
  4. # updated to PostGIS 2.0.1
  5.  
  6. # add the ubuntu gis ppa
  7. sudo apt-get -y install python-software-properties
  8. sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
  9. sudo apt-get update
  10.  
  11. # the big list of apt dependencies to check we have installed
  12. sudo apt-get -y install postgis postgresql-9.1 postgresql-server-dev-9.1 postgresql-contrib-9.1 postgis  gdal-bin binutils libgeos-3.2.2 libgeos-c1 libgeos-dev libgdal1-dev libxml2 libxml2-dev libxml2-dev checkinstall proj libpq-dev
  13.  
  14. # install the json-c library
  15. sudo apt-get install libjson0 libjson0-dev
  16.  
  17. # need to install most recent GEOS version for topology support
  18. wget http://download.osgeo.org/geos/geos-3.3.8.tar.bz2
  19. tar -jxvf geos-3.3.8.tar.bz2
  20. cd geos-3.3.8
  21. sudo ./configure && sudo make
  22.  
  23. #
  24. sudo mkdir -p '/usr/share/postgresql/9.1/contrib/postgis-2.0.2'
  25.  
  26. # fetch, compile and install PostGIS
  27. wget http://postgis.refractions.net/download/postgis-2.0.2.tar.gz
  28. tar zxvf postgis-2.0.2.tar.gz && cd postgis-2.0.2
  29. ./configure --with-raster --with-topology
  30. make    
  31. make install
  32.  
  33. ## pgrouting - Add pgRouting launchpad repository
  34. sudo add-apt-repository ppa:georepublic/pgrouting
  35. sudo apt-get update
  36.  
  37. # Install pgRouting packages
  38. sudo apt-get install gaul-devel \
  39.         postgresql-9.1-pgrouting \
  40.         postgresql-9.1-pgrouting-dd \
  41.         postgresql-9.1-pgrouting-tsp
  42.  
  43. # Install osm2pgrouting package
  44. sudo apt-get install osm2pgrouting
  45.  
  46. # Install workshop material (optional)
  47. sudo apt-get install pgrouting-workshop
  48.  
  49. # create a table called 'routing'
  50. sudo su postgres
  51. createdb routing
  52.  
  53. # add PostGIS functions (version 2.x) to 'routing'
  54. psql -d routing -c "CREATE EXTENSION postgis;"
  55.  
  56. # add pgRouting core functions to 'routing'
  57. psql -d routing -f /usr/share/postlbs/routing_core.sql
  58. psql -d routing -f /usr/share/postlbs/routing_core_wrappers.sql
  59. psql -d routing -f /usr/share/postlbs/routing_topology.sql
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement