Skip to content

Instantly share code, notes, and snippets.

@djq
Forked from rolo/gist:1481128
Last active September 27, 2022 04:12
Show Gist options
  • Select an option

  • Save djq/2846196 to your computer and use it in GitHub Desktop.

Select an option

Save djq/2846196 to your computer and use it in GitHub Desktop.

Revisions

  1. David Quinn revised this gist Apr 16, 2013. 1 changed file with 9 additions and 32 deletions.
    41 changes: 9 additions & 32 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -3,42 +3,19 @@
    # Install Postgres 9.1, PostGIS 2.0 and pgRouting on a clean Ubuntu 12.04 install (64 bit)
    # updated to PostGIS 2.0.1

    # add the ubuntu gis ppa
    sudo apt-get -y install python-software-properties
    sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
    sudo apt-get update
    # basics
    apt-get install python-software-properties
    apt-add-repository ppa:sharpie/for-science # To get GEOS 3.3.3

    # 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 gdal-bin binutils libgeos-c1 libgeos-dev libgdal1-dev libxml2 libxml2-dev libxml2-dev checkinstall libproj-dev libpq-dev build-essential
    # 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

    # install the json-c library
    sudo apt-get install libjson0 libjson0-dev
    # some missing packages for some reason
    apt-get update --fix-missing

    # 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
    # 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

    # check that your GEOS version is >= 3.3.3
    geos-config --version

    # Due to problems detecting GDAL linked files I installed GDAL using the following approach
    # Only noticed this problem in April 2013
    # GDAL takes ~30min to build
    sudo apt-get install build-essential python-all-dev
    wget http://download.osgeo.org/gdal/gdal-1.9.2tar.gz
    tar xvfz gdal-1.9.0.tar.gz
    cd gdal-1.9.0
    ./configure --with-python
    make
    sudo make install

    # then, I linked files using old instructions from here
    http://lists.osgeo.org/pipermail/gdal-dev/2010-January/023208.html

    # make a directory for postgis (Necessary?)
    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
  2. David Quinn revised this gist Apr 15, 2013. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -34,6 +34,9 @@ cd gdal-1.9.0
    make
    sudo make install

    # then, I linked files using old instructions from here
    http://lists.osgeo.org/pipermail/gdal-dev/2010-January/023208.html

    # make a directory for postgis (Necessary?)
    sudo mkdir -p '/usr/share/postgresql/9.1/contrib/postgis-2.0.2'

  3. David Quinn revised this gist Apr 15, 2013. 1 changed file with 12 additions and 1 deletion.
    13 changes: 12 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -23,7 +23,18 @@ sudo ./configure && sudo make
    # check that your GEOS version is >= 3.3.3
    geos-config --version

    #
    # Due to problems detecting GDAL linked files I installed GDAL using the following approach
    # Only noticed this problem in April 2013
    # GDAL takes ~30min to build
    sudo apt-get install build-essential python-all-dev
    wget http://download.osgeo.org/gdal/gdal-1.9.2tar.gz
    tar xvfz gdal-1.9.0.tar.gz
    cd gdal-1.9.0
    ./configure --with-python
    make
    sudo make install

    # make a directory for postgis (Necessary?)
    sudo mkdir -p '/usr/share/postgresql/9.1/contrib/postgis-2.0.2'

    # fetch, compile and install PostGIS
  4. David Quinn revised this gist Apr 15, 2013. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -20,6 +20,9 @@ tar -jxvf geos-3.3.8.tar.bz2
    cd geos-3.3.8
    sudo ./configure && sudo make

    # check that your GEOS version is >= 3.3.3
    geos-config --version

    #
    sudo mkdir -p '/usr/share/postgresql/9.1/contrib/postgis-2.0.2'

  5. David Quinn revised this gist Apr 15, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ 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 gdal-bin binutils libgeos-c1 libgeos-dev libgdal1-dev libxml2 libxml2-dev libxml2-dev checkinstall proj libpq-dev build-essential
    sudo apt-get -y install postgis 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

    # install the json-c library
    sudo apt-get install libjson0 libjson0-dev
  6. David Quinn revised this gist Apr 15, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ 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 gdal-bin binutils libgeos-3.2.2 libgeos-c1 libgeos-dev libgdal1-dev libxml2 libxml2-dev libxml2-dev checkinstall proj libpq-dev build-essential
    sudo apt-get -y install postgis 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 proj libpq-dev build-essential

    # install the json-c library
    sudo apt-get install libjson0 libjson0-dev
  7. David Quinn revised this gist Apr 15, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ 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 build-essential
    sudo apt-get -y install postgis postgresql-9.1 postgresql-server-dev-9.1 postgresql-contrib-9.1 gdal-bin binutils libgeos-3.2.2 libgeos-c1 libgeos-dev libgdal1-dev libxml2 libxml2-dev libxml2-dev checkinstall proj libpq-dev build-essential

    # install the json-c library
    sudo apt-get install libjson0 libjson0-dev
  8. David Quinn revised this gist Apr 15, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ 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
    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 build-essential

    # install the json-c library
    sudo apt-get install libjson0 libjson0-dev
  9. David Quinn revised this gist Feb 28, 2013. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -21,13 +21,13 @@ cd geos-3.3.8
    sudo ./configure && sudo make

    #
    sudo mkdir -p '/usr/share/postgresql/9.1/contrib/postgis-2.0.1'
    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.tar.gz
    tar zxvf postgis-2.0.2.tar.gz && cd postgis-2.0.2
    ./configure --with-raster --with-topology
    make
    make
    make install

    ## pgrouting - Add pgRouting launchpad repository
  10. David Quinn revised this gist Feb 28, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -24,8 +24,8 @@ sudo ./configure && sudo make
    sudo mkdir -p '/usr/share/postgresql/9.1/contrib/postgis-2.0.1'

    # fetch, compile and install PostGIS
    wget http://postgis.refractions.net/download/postgis-2.0.1.tar.gz
    tar zxvf postgis-2.0.1.tar.gz && cd postgis-2.0.1/
    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.tar.gz
    ./configure --with-raster --with-topology
    make
    make install
  11. David Quinn revised this gist Feb 28, 2013. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -15,9 +15,9 @@ sudo apt-get -y install postgis postgresql-9.1 postgresql-server-dev-9.1 postgre
    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.4.tar.bz2
    tar -jxvf geos-3.3.4.tar.bz2
    cd geos-3.3.4
    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

    #
  12. David Quinn revised this gist Sep 25, 2012. No changes.
  13. David Quinn revised this gist Sep 24, 2012. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -46,11 +46,14 @@ 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)
    # add PostGIS functions (version 2.x) to 'routing'
    psql -d routing -c "CREATE EXTENSION postgis;"

    # add pgRouting core functions
    # 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
  14. David Quinn revised this gist Sep 24, 2012. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -11,6 +11,9 @@ 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.4.tar.bz2
    tar -jxvf geos-3.3.4.tar.bz2
    @@ -23,7 +26,7 @@ sudo mkdir -p '/usr/share/postgresql/9.1/contrib/postgis-2.0.1'
    # fetch, compile and install PostGIS
    wget http://postgis.refractions.net/download/postgis-2.0.1.tar.gz
    tar zxvf postgis-2.0.1.tar.gz && cd postgis-2.0.1/
    ./configure
    ./configure --with-raster --with-topology
    make
    make install

    @@ -50,4 +53,4 @@ psql -d routing -c "CREATE EXTENSION postgis;"
    # add pgRouting core functions
    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
    psql -d routing -f /usr/share/postlbs/routing_topology.sql
  15. David Quinn revised this gist Sep 24, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    #!/bin/bash
    #
    # Install Postgres 9.1, PostGIS 2.0 and PGRouting on a clean Ubuntu 12.04 install (64 bit)
    # Install Postgres 9.1, PostGIS 2.0 and pgRouting on a clean Ubuntu 12.04 install (64 bit)
    # updated to PostGIS 2.0.1

    # add the ubuntu gis ppa
  16. David Quinn revised this gist Sep 24, 2012. 1 changed file with 26 additions and 24 deletions.
    50 changes: 26 additions & 24 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,7 @@
    #!/bin/bash
    #
    # Install Postgres 9.1, PostGIS and create PostGIS template on a clean Ubuntu 12.04 install (64 bit)
    # I have just replaced '1.5' with '2.0'
    # updated to 2.0.1
    # Install Postgres 9.1, PostGIS 2.0 and PGRouting on a clean Ubuntu 12.04 install (64 bit)
    # updated to PostGIS 2.0.1

    # add the ubuntu gis ppa
    sudo apt-get -y install python-software-properties
    @@ -28,24 +27,27 @@ tar zxvf postgis-2.0.1.tar.gz && cd postgis-2.0.1/
    make
    make install

    #
    # Done. The new package has been installed and saved to
    #
    # /home/djq/postgis-2.0.0/postgis-2.0.0_2.0.0-src-1_amd64.deb
    #
    # You can remove it from your system anytime using:
    #
    # dpkg -r postgis-2.0.0


    # now create the template_postgis database template
    sudo su postgres -c'createdb -E UTF8 -U postgres template_postgis'
    sudo su postgres -c'createlang -d template_postgis plpgsql;'
    sudo su postgres -c'psql -U postgres -d template_postgis -c"CREATE EXTENSION hstore;"'
    sudo su postgres -c'psql -U postgres -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-2.0/postgis.sql'
    sudo su postgres -c'psql -U postgres -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-2.0/spatial_ref_sys.sql'
    sudo su postgres -c'psql -U postgres -d template_postgis -c"select postgis_lib_version();"'
    sudo su postgres -c'psql -U postgres -d template_postgis -c "GRANT ALL ON geometry_columns TO PUBLIC;"'
    sudo su postgres -c'psql -U postgres -d template_postgis -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;"'
    sudo su postgres -c'psql -U postgres -d template_postgis -c "GRANT ALL ON geography_columns TO PUBLIC;"'
    echo "Done!"
    ## 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


    # add PostGIS functions (version 2.x)
    psql -d routing -c "CREATE EXTENSION postgis;"

    # add pgRouting core functions
    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
  17. David Quinn revised this gist Sep 22, 2012. 1 changed file with 14 additions and 12 deletions.
    26 changes: 14 additions & 12 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    #!/bin/bash
    #
    # Install Postgres 9.1, PostGIS and create PostGIS template on a clean Ubuntu 12.04 install (64 bit)
    # I have just replace '1.5' with '2.0'
    # I have just replaced '1.5' with '2.0'
    # updated to 2.0.1

    # add the ubuntu gis ppa
    @@ -19,21 +19,23 @@ cd geos-3.3.4
    sudo ./configure && sudo make

    #
    sudo mkdir -p '/usr/share/postgresql/9.1/contrib/postgis-2.0.0'
    sudo mkdir -p '/usr/share/postgresql/9.1/contrib/postgis-2.0.1'

    # fetch, compile and install PostGIS
    wget http://postgis.refractions.net/download/postgis-2.0.0.tar.gz
    tar zxvf postgis-2.0.0.tar.gz && cd postgis-2.0.0/
    sudo ./configure && sudo make && sudo checkinstall --pkgname postgis-2.0.0 --pkgversion 2.0.0-src --default
    wget http://postgis.refractions.net/download/postgis-2.0.1.tar.gz
    tar zxvf postgis-2.0.1.tar.gz && cd postgis-2.0.1/
    ./configure
    make
    make install

    #
    Done. The new package has been installed and saved to

    /home/djq/postgis-2.0.0/postgis-2.0.0_2.0.0-src-1_amd64.deb

    You can remove it from your system anytime using:

    dpkg -r postgis-2.0.0
    # Done. The new package has been installed and saved to
    #
    # /home/djq/postgis-2.0.0/postgis-2.0.0_2.0.0-src-1_amd64.deb
    #
    # You can remove it from your system anytime using:
    #
    # dpkg -r postgis-2.0.0


    # now create the template_postgis database template
  18. David Quinn revised this gist Sep 22, 2012. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,8 @@
    #!/bin/bash
    #
    # Install Postgres 9.1, PostGIS and create PostGIS template on a clean Ubuntu 12.04 install
    # Install Postgres 9.1, PostGIS and create PostGIS template on a clean Ubuntu 12.04 install (64 bit)
    # I have just replace '1.5' with '2.0'
    # updated to 2.0.1

    # add the ubuntu gis ppa
    sudo apt-get -y install python-software-properties
  19. David Quinn revised this gist Jun 1, 2012. 1 changed file with 25 additions and 8 deletions.
    33 changes: 25 additions & 8 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    #!/bin/bash
    #
    # Install Postgres 9.1, PostGIS and create PostGIS template on a clean Ubuntu 11.10 Oneiric Ocelot box
    # http://wildfish.com
    # Install Postgres 9.1, PostGIS and create PostGIS template on a clean Ubuntu 12.04 install
    # I have just replace '1.5' with '2.0'

    # add the ubuntu gis ppa
    sudo apt-get -y install python-software-properties
    @@ -11,19 +11,36 @@ 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

    sudo mkdir -p '/usr/share/postgresql/9.1/contrib/postgis-1.5'
    # need to install most recent GEOS version for topology support
    wget http://download.osgeo.org/geos/geos-3.3.4.tar.bz2
    tar -jxvf geos-3.3.4.tar.bz2
    cd geos-3.3.4
    sudo ./configure && sudo make

    #
    sudo mkdir -p '/usr/share/postgresql/9.1/contrib/postgis-2.0.0'

    # fetch, compile and install PostGIS
    wget http://postgis.refractions.net/download/postgis-1.5.3.tar.gz
    tar zxvf postgis-1.5.3.tar.gz && cd postgis-1.5.3/
    sudo ./configure && sudo make && sudo checkinstall --pkgname postgis-1.5.3 --pkgversion 1.5.3-src --default
    wget http://postgis.refractions.net/download/postgis-2.0.0.tar.gz
    tar zxvf postgis-2.0.0.tar.gz && cd postgis-2.0.0/
    sudo ./configure && sudo make && sudo checkinstall --pkgname postgis-2.0.0 --pkgversion 2.0.0-src --default

    #
    Done. The new package has been installed and saved to

    /home/djq/postgis-2.0.0/postgis-2.0.0_2.0.0-src-1_amd64.deb

    You can remove it from your system anytime using:

    dpkg -r postgis-2.0.0


    # now create the template_postgis database template
    sudo su postgres -c'createdb -E UTF8 -U postgres template_postgis'
    sudo su postgres -c'createlang -d template_postgis plpgsql;'
    sudo su postgres -c'psql -U postgres -d template_postgis -c"CREATE EXTENSION hstore;"'
    sudo su postgres -c'psql -U postgres -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql'
    sudo su postgres -c'psql -U postgres -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql'
    sudo su postgres -c'psql -U postgres -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-2.0/postgis.sql'
    sudo su postgres -c'psql -U postgres -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-2.0/spatial_ref_sys.sql'
    sudo su postgres -c'psql -U postgres -d template_postgis -c"select postgis_lib_version();"'
    sudo su postgres -c'psql -U postgres -d template_postgis -c "GRANT ALL ON geometry_columns TO PUBLIC;"'
    sudo su postgres -c'psql -U postgres -d template_postgis -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;"'
  20. @rolo rolo created this gist Dec 15, 2011.
    31 changes: 31 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    #!/bin/bash
    #
    # Install Postgres 9.1, PostGIS and create PostGIS template on a clean Ubuntu 11.10 Oneiric Ocelot box
    # http://wildfish.com

    # add the ubuntu gis ppa
    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

    sudo mkdir -p '/usr/share/postgresql/9.1/contrib/postgis-1.5'

    # fetch, compile and install PostGIS
    wget http://postgis.refractions.net/download/postgis-1.5.3.tar.gz
    tar zxvf postgis-1.5.3.tar.gz && cd postgis-1.5.3/
    sudo ./configure && sudo make && sudo checkinstall --pkgname postgis-1.5.3 --pkgversion 1.5.3-src --default

    # now create the template_postgis database template
    sudo su postgres -c'createdb -E UTF8 -U postgres template_postgis'
    sudo su postgres -c'createlang -d template_postgis plpgsql;'
    sudo su postgres -c'psql -U postgres -d template_postgis -c"CREATE EXTENSION hstore;"'
    sudo su postgres -c'psql -U postgres -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql'
    sudo su postgres -c'psql -U postgres -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql'
    sudo su postgres -c'psql -U postgres -d template_postgis -c"select postgis_lib_version();"'
    sudo su postgres -c'psql -U postgres -d template_postgis -c "GRANT ALL ON geometry_columns TO PUBLIC;"'
    sudo su postgres -c'psql -U postgres -d template_postgis -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;"'
    sudo su postgres -c'psql -U postgres -d template_postgis -c "GRANT ALL ON geography_columns TO PUBLIC;"'
    echo "Done!"