Move the GeoServer Data Directory

 

To make GeoServer more portable and easier to upgrade, you should change the GeoServer data directory.

Follow the instructions below, substituting your own paths and file names.

 

1. Stop Tomcat

 

2. Connect via SSH and move the data directory as below: (Important: the target directory - 'geo_data' below - should not exist.)

mv /home/tomcat/apache-tomcat-8.5.15/webapps/geoserver/data/ /var/lib/geo_data/ 
 

3. Add the following to your GeoServer web.xml file.

<context-param>
       <param-name>GEOSERVER_DATA_DIR</param-name>
<param-value>/var/lib/geo_data</param-value>
</context-param>

<context-param>
<param-name>GEOSERVER_REQUIRE_FILE</param-name>
<param-value>/var/lib/geo_data/global.xml</param-value>
</context-param>

 

4. Start Tomcat

You should log into GeoServer and verify that your workspaces, etc.. are accesible.