Skip to content

Instantly share code, notes, and snippets.

Revisions

  1. akkerman revised this gist Oct 4, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Install PostGIS and GeoServer on Ubuntu 13.04.md
    Original file line number Diff line number Diff line change
    @@ -113,7 +113,7 @@ If you still get a 503 error (temporary unavailable) first try a refresh, if tha
    [PostGIS install](http://postgis.net/install/)
    [PostGIS install Ubuntu 13.04](http://trac.osgeo.org/postgis/wiki/UsersWikiPostGIS20Ubuntu1304)
    [geoserver.org](http://geoserver.org)
    [Publishing a PostGIS Table on GeoServer](http://docs.geoserver.org/stable/en/user/gettingstarted/postgis-quickstart/index.html)
    [Publishing a PostGIS Table on GeoServer](http://docs.geoserver.org/stable/en/user/gettingstarted/postgis-quickstart/index.html)



  2. akkerman revised this gist Oct 4, 2013. 1 changed file with 6 additions and 2 deletions.
    8 changes: 6 additions & 2 deletions Install PostGIS and GeoServer on Ubuntu 13.04.md
    Original file line number Diff line number Diff line change
    @@ -110,6 +110,10 @@ If you still get a 503 error (temporary unavailable) first try a refresh, if tha


    ## See Also
    [http://postgis.net/install/](http://postgis.net/install/)
    [http://trac.osgeo.org/postgis/wiki/UsersWikiPostGIS20Ubuntu1304](http://trac.osgeo.org/postgis/wiki/UsersWikiPostGIS20Ubuntu1304)
    [PostGIS install](http://postgis.net/install/)
    [PostGIS install Ubuntu 13.04](http://trac.osgeo.org/postgis/wiki/UsersWikiPostGIS20Ubuntu1304)
    [geoserver.org](http://geoserver.org)
    [Publishing a PostGIS Table on GeoServer](http://docs.geoserver.org/stable/en/user/gettingstarted/postgis-quickstart/index.html)



  3. akkerman revised this gist Oct 4, 2013. 1 changed file with 6 additions and 2 deletions.
    8 changes: 6 additions & 2 deletions Install PostGIS and GeoServer on Ubuntu 13.04.md
    Original file line number Diff line number Diff line change
    @@ -110,6 +110,10 @@ If you still get a 503 error (temporary unavailable) first try a refresh, if tha


    ## See Also
    [http://postgis.net/install/](http://postgis.net/install/)
    [http://trac.osgeo.org/postgis/wiki/UsersWikiPostGIS20Ubuntu1304](http://trac.osgeo.org/postgis/wiki/UsersWikiPostGIS20Ubuntu1304)
    [PostGIS install](http://postgis.net/install/)
    [PostGIS install Ubuntu 13.04](http://trac.osgeo.org/postgis/wiki/UsersWikiPostGIS20Ubuntu1304)
    [geoserver.org](http://geoserver.org)
    [Publishing a PostGIS Table on GeoServer](http://docs.geoserver.org/stable/en/user/gettingstarted/postgis-quickstart/index.html)



  4. akkerman created this gist Oct 4, 2013.
    115 changes: 115 additions & 0 deletions Install PostGIS and GeoServer on Ubuntu 13.04.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,115 @@
    # Install PostGIS and GeoServer on Ubuntu 13.04

    ## PostGIS installation
    ### Postgresql
    Install the server:

    sudo apt-get install postgresql-9.1 postgresql-contrib-9.1 pgadmin3

    Execute the psql command under user `postgres` (sudo -u postgres)
    and connect to database `postgres` (psql postgres):

    sudo -u postgres psql postgres

    In this sql shell change the password:

    \password

    Exit sql shell :

    \quit

    You can now fire-up pgAdmin III and test if you can connect to PostgreSQL

    ### Postgis

    Add PPA using:

    sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable

    Go to 'Ubuntu Software Center' and, from the menu, choose 'Edit -> Software Sources...'.
    Change the distribution for http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu from 'raring' to 'quantal'.
    Otherwise you will get an error message (`could not open extension control file`) when adding the PostGIS extension to your database.

    Install postgis:

    sudo apt-get install postgis postgresql-9.1-postgis-2.0 postgresql-9.1-postgis-2.0-scripts

    #### Spatially enabling PostgreSQL
    Connect to PostgreSQL using pgAdmin III and create a new database (e.g. geo).
    After creation look for a sub-node on your database called 'Extensions' add the following extensions (right click, new extension..).

    * postgis
    * postgis_topology

    ## GeoServer installation
    There are several ways to install GeoServer this document describes installing it on Tomcat7. Since we want a play HTML/JavaScript application to be able to access it we're going to hide it behind Apache2 which will also serve the bespoke application.
    ### Server installation
    Install Apache2 and Tomcat7:

    sudo apt-get install apache2 tomcat7 tomcat7-admin

    Install GeoServer war

    wget http://sourceforge.net/projects/geoserver/files/GeoServer/2.4.0/geoserver-2.4.0-war.zip
    unzip geoserver-2.4.0-war.zip geoserver.war
    sudo mv geoserver.war /var/lib/tomcat7/webapps/

    It can take a little while for the web app to load, check if it is running by redirecting your browser to: [http://localhost:8080/geoserver](http://localhost:8080/geoserver)
    login with username __admin__ and password __geoserver__

    ### Configure reverse proxy (Apache2)
    Enable additional modules:

    sudo a2enmod proxy proxy_ajp

    Add directive by editing a new file:

    sudo vi /etc/apache2/conf.d/proxy.conf
    or

    sudo nano /etc/apache2/conf.d/proxy.conf
    Add the following line (note the port):

    ProxyPass /geoserver ajp://localhost:8009/geoserver

    Restart apache:

    sudo service apache2 restart

    If you now go to [http://localhost/geoserver](http://localhost/geoserver) you will get a 503 error instead of a 404 since we first have to configure Tomcat7.

    ### Configure AJP Connector (Tomcat7)
    Open up the server.xml file:

    sudo vi /etc/tomcat7/server.xml

    or

    sudo nano /etc/tomcat7/server.xml

    Look for this fragment:

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <!--
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
    -->

    Change to:

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" protocol="AJP/1.3" />

    Save the file and restart Tomcat:

    sudo service tomcat7 restart

    If you now browse to [http://localhost/geoserver](http://localhost/geoserver) you should see geoserver through apache2 reverse proxy. (first time could take a while since the app is restarting)
    If you still get a 503 error (temporary unavailable) first try a refresh, if that doesn't help, try and restart Apache2.


    ## See Also
    [http://postgis.net/install/](http://postgis.net/install/)
    [http://trac.osgeo.org/postgis/wiki/UsersWikiPostGIS20Ubuntu1304](http://trac.osgeo.org/postgis/wiki/UsersWikiPostGIS20Ubuntu1304)