-
-
Save jfreyre/5371608 to your computer and use it in GitHub Desktop.
Install Postgres 9.1, PostGIS 2.0 and pgRouting on a clean Ubuntu 12.04 install
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Install Postgres 9.1, PostGIS 2.0.2 and pgRouting on a clean Ubuntu 12.04 install | |
# updated to PostGIS 2.0.2 | |
# add the ubuntu gis ppa repository | |
sudo apt-get -y install python-software-properties | |
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable | |
sudo apt-get update | |
# the big list of apt dependencies to check we have installed | |
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 | |
# install the json-c library | |
sudo apt-get install libjson0 libjson0-dev | |
# need to install most recent GEOS version for topology support | |
wget http://download.osgeo.org/geos/geos-3.3.8.tar.bz2 | |
tar -jxvf geos-3.3.8.tar.bz2 | |
cd geos-3.3.8 | |
sudo ./configure && sudo make | |
# | |
sudo mkdir -p '/usr/share/postgresql/9.1/contrib/postgis-2.0.2' | |
# fetch, compile and install PostGIS | |
wget http://postgis.refractions.net/download/postgis-2.0.2.tar.gz | |
tar zxvf postgis-2.0.2.tar.gz && cd postgis-2.0.2 | |
./configure --with-raster --with-topology | |
make | |
make install | |
## pgrouting - Add pgRouting launchpad repository | |
sudo add-apt-repository ppa:georepublic/pgrouting | |
sudo apt-get update | |
# Install pgRouting packages | |
sudo apt-get install gaul-devel \ | |
postgresql-9.1-pgrouting \ | |
postgresql-9.1-pgrouting-dd \ | |
postgresql-9.1-pgrouting-tsp | |
# Install osm2pgrouting package | |
sudo apt-get install libpq++ | |
sudo apt-get install libboost-all-dev | |
wget https://github.com/pgRouting/osm2pgrouting/archive/master.zip | |
unzip master.zip | |
cd osm2pgrouting-master | |
make | |
# create a table called 'routing' | |
sudo su postgres | |
createdb routing | |
# add PostGIS functions (version 2.x) to 'routing' | |
psql -d routing -c "CREATE EXTENSION postgis;" | |
# add pgRouting core functions to 'routing' | |
psql -d routing -f /usr/share/postlbs/matching.sql | |
psql -d routing -f /usr/share/postlbs/routing_core.sql | |
psql -d routing -f /usr/share/postlbs/routing_core_wrappers.sql | |
psql -d routing -f /usr/share/postlbs/routing_dd.sql | |
psql -d routing -f /usr/share/postlbs/routing_dd_wrappers.sql | |
psql -d routing -f /usr/share/postlbs/routing_topology.sql | |
psql -d routing -f /usr/share/postlbs/routing_tsp.sql | |
psql -d routing -f /usr/share/postlbs/routing_tsp_wrappers.sql | |
# Render routing database compliant with old functions | |
# used in osm2pgrouting | |
psql -d routing -f legacy.sql | |
createdb vaud_routing --template=routing | |
# logout from postgres | |
exit | |
# downloading a sample osm file | |
wget http://downloads.cloudmade.com/europe/western_europe/switzerland/vaud/vaud.osm.bz2 | |
bunzip2 vaud.osm.bz2 | |
# launching an import | |
./osm2pgrouting -file ../osm_files/vaud.osm -conf ./mapconfig.xml -dbname vaud -user postgres -passwd postgres -host 127.0.0.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment