Apache2 – Geoserver and Geonetwork on Tomcat7

During my work at Institute of Geodesy, Cartography and Remote Sensing I’ve came across with this configuration. I must state that this is not a step by step tutorial, but a short guide.

OS Specfication

  • Debian Wheezy run on Virtual Box
  • 8GB of HDD
  • 2GB of memory

After installing Apache2 and Tomcat7, Geoserver and Geonetwork are waiting to be installed. I’ve chosen .war (Web Archive) based installation, due to the nature of Tomcat7 it’s much easier to do so. Let’s begin by downloading geoserver.war and geonetwork.war .

1
  copy geoserver.war and geonetwork.war to /var/lib/tomcat7/webapps
  copy geoserver.war and geonetwork.war to /var/lib/tomcat7/webapps

Tomcat will automatically load these applications without starting them. As for Geoserver you don’t have to do much, it’s working out of the box.

However Geonetwork have caused a bit of headache for me. Looking for some installation instructions on using Web archive was lack of success. A small installation tutorial was found, although this was missleading. By the way, I’m using PostgreSQL for storing Geonetwork data.

Configuration for PostgreSQL
1
2
3
  # Set peer or md5 for authentication method in hg_dba.conf if needed
  create user geonetwork with password='almafa';
  create database geonetwork with owner=geonetwork encoding 'UTF8';
  # Set peer or md5 for authentication method in hg_dba.conf if needed
  create user geonetwork with password='almafa';
  create database geonetwork with owner=geonetwork encoding 'UTF8';
Configuration for Geonetwork

Two things must be changed in config.xml In /var/lib/tomcat7/webapps/geonetwork/WEB-INF (find section:

1
2
3
4
5
6
7
8
  <!-- Regarding H2 storage -->
 
  <!-- Find resource related to Postgresql and update it to-->
  <resource enabled="true"
    jeeves.resources.dbms.ApacheDBCPool
    geonetwork
    almafa
    ...
  <!-- Regarding H2 storage -->

  <!-- Find resource related to Postgresql and update it to-->
  <resource enabled="true"
    jeeves.resources.dbms.ApacheDBCPool
    geonetwork
    almafa
    ...

That’s all you need to do for GeoNetwork configuration. Do not add sql files in setup/sql folder nor data-default.sql files, this will cause Geonetwork to crash, because at first run it will setup all tables and data for you!

Configuration for Apache2 using ProxyPass

Let’s start with sym-linking proxypass configurations.

1
2
3
sudo ln -s /etc/apache2/mods-available/proxy.conf /etc/apache2/mods-enabled/proxy.conf
sudo ln -s /etc/apache2/mods-available/proxy.load /etc/apache2/mods-enabled/proxy.load
sudo ln -s /etc/apache2/mods-available/proxy_http.load /etc/apache2/mods-enabled/proxy_http.load
sudo ln -s /etc/apache2/mods-available/proxy.conf /etc/apache2/mods-enabled/proxy.conf
sudo ln -s /etc/apache2/mods-available/proxy.load /etc/apache2/mods-enabled/proxy.load
sudo ln -s /etc/apache2/mods-available/proxy_http.load /etc/apache2/mods-enabled/proxy_http.load

Add ProxyPass in /etc/apache2/sites-available/default :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
 ProxyRequests Off
 # Remember to turn the next line off if you are proxying to a NameVirtualHost
 ProxyPreserveHost On 
 
  Order deny,allow
  Allow from all 
 
 # ProxyPass for Geoserver
 ProxyPass /geoserver http://localhost:8888/geoserver
 ProxyPassReverse /geoserver http://localhost:8888/geoserver 
 
 # ProxyPass for Geonetwork
 ProxyPass /geonetwork http://localhost:8888/geonetwork
 ProxyPassReverse /geonetwork http://localhost:8888/geonetwork 
 ProxyRequests Off
 # Remember to turn the next line off if you are proxying to a NameVirtualHost
 ProxyPreserveHost On 

  Order deny,allow
  Allow from all 

 # ProxyPass for Geoserver
 ProxyPass /geoserver http://localhost:8888/geoserver
 ProxyPassReverse /geoserver http://localhost:8888/geoserver 

 # ProxyPass for Geonetwork
 ProxyPass /geonetwork http://localhost:8888/geonetwork
 ProxyPassReverse /geonetwork http://localhost:8888/geonetwork 

Restart your Apache and Tomcat7 services