Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d3netxer/64ec902b8d3707a70468b12a0cd3044e to your computer and use it in GitHub Desktop.
Save d3netxer/64ec902b8d3707a70468b12a0cd3044e to your computer and use it in GitHub Desktop.

Installing GeoServer with GDAL Extension on Ubuntu 16.04 Ver2

sudo apt-get update

Install Java 8 from OpenJDK (even though Oracle is recommended, also Java 9 is not supported for Geoserver 2.12)

https://medium.com/coderscorner/installing-oracle-java-8-in-ubuntu-16-10-845507b13343

sudo apt-get install openjdk-8-jdk

Install dev version of gdal, dev version of geos, dev version of libpq, and gdal command line tools

sudo apt-get install libgdal-dev libgeos-dev libpq-dev gdal-bin

Install Tomcat8

sudo apt-get install tomcat8

This creates the tomcat8 user

sudo service tomcat8 start

go to the ip address and the 8080 port (ex: http://34.229.242.250:8080/) and you should see that it works!

Here is where your webapp should be: /var/lib/tomcat8/webapps/

Install Geoserver

In the home dir of the server wget the WAR (web archive from the Geoserver version you want, ex from this page: http://geoserver.org/release/stable/)

wget http://sourceforge.net/projects/geoserver/files/GeoServer/2.12.1/geoserver-2.12.1-war.zip
sudo apt-get install unzip
unzip geoserver-2.12.1-war.zip 

now you need to copy the geoserver.war file to the Tomcat8 webapps dir (/var/lib/tomcat8/webapps/).

sudo cp geoserver.war /var/lib/tomcat8/webapps/

Installing GDAL, now is where things get complicated

My understanding is that Geoserver still relies on GDAL version 1. The sudo apt-get install libgdal-dev and gdal-bin commands should have install version 1.11.3

GeoServer can leverage the ImageI/O-Ext GDAL libraries to read selected coverage formats.

The ImageIO-Ext is an Open Source project that provides extensions, fixes and improvements for the standard Oracle Java Image I/O project such as support for the GDAL I/O library

The core module of the project is the gdalframework module which provide a bridge between the Java Image I/O framework and the Geospatial Data Abstraction Library via SWIG's generated Java bindings to provide support for a reach set of data formats.

Install GDAL extension

From GeoServer version 2.2.x, the GDAL extension must be installed. To install it:

  1. Navigate to the GeoServer download page.

  2. Find the page that matches the version of the running GeoServer (http://geoserver.org/release/stable/).

Warning Be sure to match the version of the extension with that of GeoServer, otherwise errors will occur. Download the GDAL extension. The download link for GDAL will be in the Extensions section under Coverage Format.

  1. Extract the files in this archive to the WEB-INF/lib directory of your GeoServer installation.

Installing GDAL native libraries

The ImageIO-Ext GDAL plugin for geoserver master uses ImageIO-Ext 1.1.16 whose artifacts can be downloaded. From the Image IO-Ext gdal artifact download link we need to download two things:

  1. The CRS definitions (this means the gdal-data.zip file)
  • download the CRS definitions archive named “gdal_data.zip”
  • Extract this archive on disk and place it in a proper directory on your system. (like in the /opt dir for instance)
/home/ubuntu$ http://demo.geo-solutions.it/share/github/imageio-ext/releases/1.1.X/1.1.16/native/gdal/gdal-data.zip

GDAL_DATA is an environment variable used to specify location of supporting files used by GDAL library as well as GDAL and OGR utilities. For instance, in order for OGR and GDAL to properly evaluate EPSG codes you need to have the EPSG support files (so called dictionaries, mostly in CSV format), like gcs.csv and pcs.csv, found in the directory pointed by GDAL_DATA variable.

  • Add the GDAL_DATA environment variable to the tomcat config file (/etc/default/tomcat8). Make also sure that this directory is reachable and readable by the application server process’s user. Ex: add this line to /etc/default/tomcat8 GDAL_DATA=/opt/gdal-data
  1. The native libraries matching the target operating system (use gdal192-Ubuntu12-gcc4.6.3-x86_64.tar.gz)
$ wget http://demo.geo-solutions.it/share/github/imageio-ext/releases/1.1.X/1.1.16/native/gdal/linux/gdal192-Ubuntu12-gcc4.6.3-x86_64.tar.gz
$ tar xzvf gdal-1.9.2.tar.gz
  • Add the LD_LIBRARY_PATH environment variable to the tomcat config file (/etc/default/tomcat8). Make also sure that this directory is reachable and readable by the application server process’s user. Ex: add this line to /etc/default/tomcat8 LD_LIBRARY_PATH=/opt/gdal192
sudo service tomcat8 restart

Now check your geoserver and see if the additional GDAL extensions appear when you create a new store

Post-Install: Fine Tuning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment