Created
August 19, 2013 14:50
-
-
Save regisnew/6269973 to your computer and use it in GitHub Desktop.
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 and pgRouting on a clean Ubuntu 12.04 install (64 bit) | |
# updated to PostGIS 2.0.1 | |
# basics | |
apt-get install python-software-properties | |
apt-add-repository ppa:sharpie/for-science # To get GEOS 3.3.3 | |
# install the following pacakages | |
apt-get -y install postgresql-9.1 postgresql-server-dev-9.1 postgresql-contrib-9.1 gdal-bin binutils libgeos-c1 libgeos-dev libgdal1-dev libxml2 libxml2-dev libxml2-dev checkinstall libproj-dev libpq-dev build-essential | |
# some missing packages for some reason | |
apt-get update --fix-missing | |
# run again | |
apt-get -y install postgresql-9.1 postgresql-server-dev-9.1 postgresql-contrib-9.1 gdal-bin binutils libgeos-c1 libgeos-dev libgdal1-dev libxml2 libxml2-dev libxml2-dev checkinstall libproj-dev libpq-dev build-essential | |
# fetch, compile and install PostGIS | |
wget http://download.osgeo.org/postgis/source/postgis-2.1.0.tar.gz | |
tar zxvf postgis-2.1.0.tar.gz && cd postgis-2.1.0 | |
./configure --with-raster --with-topology | |
make | |
make install | |
sudo -u postgres createdb -E UTF8 template_postgis2 | |
sudo -u postgres createlang -d template_postgis2 plpgsql | |
sudo -u postgres psql -d postgres -c "UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis2'" | |
sudo -u postgres psql -d template_postgis2 -f /usr/share/postgresql/9.1/contrib/postgis-2.1/postgis.sql | |
sudo -u postgres psql -d template_postgis2 -f /usr/share/postgresql/9.1/contrib/postgis-2.1/spatial_ref_sys.sql | |
sudo -u postgres psql -d template_postgis2 -f /usr/share/postgresql/9.1/contrib/postgis-2.1/rtpostgis.sql | |
sudo -u postgres psql -d template_postgis2 -c "GRANT ALL ON geometry_columns TO PUBLIC;" | |
sudo -u postgres psql -d template_postgis2 -c "GRANT ALL ON geography_columns TO PUBLIC;" | |
sudo -u postgres psql -d template_postgis2 -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;" | |
## 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 osm2pgrouting | |
# Install workshop material (optional) | |
sudo apt-get install pgrouting-workshop | |
# 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/routing_core.sql | |
psql -d routing -f /usr/share/postlbs/routing_core_wrappers.sql | |
psql -d routing -f /usr/share/postlbs/routing_topology.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment