Install GeoServer Application

In this section we are going to setup GeoServer for GeoNode. GeoServer will run inside Tomcat servlet container.

Setup GeoServer

You’ve already installed Tomcat 8 in the system in the first section of the training. Before you deploy GeoServer stop the running Tomcat instance::

sudo service tomcat8 stop

Now copy the downloaded GeoServer archive inside Tomcat’s webapps folder:

sudo cp /home/geonode/geonode/downloaded/geoserver-2.9.x-oauth2.war /home/geonode/geonode/downloaded/geoserver.war
sudo mv /home/geonode/geonode/downloaded/geoserver.war /var/lib/tomcat8/webapps/

Test GeoServer

Now start Tomcat to deploy GeoServer:

sudo service tomcat8 start

Tomcat will extract GeoServer web archive and start GeoServer. This may take some time

Open a web browser (in this example Firefox) and navigate to http://localhost:8080/geoserver

Connecto to GeoServer

In a few seconds GeoServer web interface will show up:

Connecto to GeoServer

GeoNode authentication integration

All we need to do now is to integrate GeoNode authentication so that GeoNode administrator will be able to access and administer GeoServer as well.

Stop GeoServer:

sudo service tomcat8 stop

And navigate to /var/lib/tomcat8/webapps/geoserver/WEB-INF/:

cd /var/lib/tomcat8/webapps/geoserver/WEB-INF/

Edit web.xml with a text editor:

sudo gedit web.xml

And add the following::

<context-param>
    <param-name>GEONODE_BASE_URL</param-name>
    <param-value>http://localhost/</param-value>
</context-param>

Note

If GeoServer is installed on machine that is separate from the one running GeoNode, change the GEONODE_BASE_URL value accordingly

The resulting file should look like this::

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
    <display-name>GeoServer</display-name>

  <context-param>
    <param-name>GEONODE_BASE_URL</param-name>
    <param-value>http://localhost/</param-value>
  </context-param>

  <context-param>
    <param-name>serviceStrategy</param-name>
    <!-- Meaning of the different values :

         PARTIAL-BUFFER2
         - Partially buffers the first xKb to disk. Once that has buffered, the the
           result is streamed to the user. This will allow for most errors to be caught
           early.
    ...

Note

If GeoServer is installed on machine that is separate from the one running GeoNode there is one more step to follow. Edit config.xml file as follows::

cd /var/lib/tomcat8/webapps/geoserver/data/security/auth/geonodeAuthProvider
sudo gedit config.xml

Set the baseUrl to GeoNode IP or hostname:

<org.geonode.security.GeoNodeAuthProviderConfig>
<id>-54fbcd7b:1402c24f6bc:-7fe9</id>
<name>geonodeAuthProvider</name>
<className>org.geonode.security.GeoNodeAuthenticationProvider</className>
<baseUrl>http://localhost/</baseUrl>
</org.geonode.security.GeoNodeAuthProviderConfig>

Restart GeoServer to make the changes effective:

sudo service tomcat8 start