The Map Is Not The Territory

A blog by Christian Willmes.

GeoNode installation on two hard disks

| categories: webdev, ubuntu, open source, geospatial, server | View Comments

I had to install GeoNode on a server with a (small) hard disk for the OS (Ubuntu Server) + software, and a second larger hard disk volume for the data. If you install geonode from the package source via apt-get, like me, you need to adapt the data locations to use the large hard disk volume. Otherwise, the data will end up on the small hard disk, where the GeoNode application is installed by default.

Because I had some work to find the best way on configuring the system in such an environment, I thought it would be good to write it into the internet, so that other people searching for solutions can find some.

System setup

As already mentioned the server runs a Ubuntu Server 14.04 LTS OS. GeoNode is installed via package install:

$ sudo add-apt-repository ppa:geonode/testing
$ sudo apt-get update
$ sudo apt-get install geonode

The second larger hard disk is mounted into '/media/data'. The goal is to have at least the most locations, where geonode stores its data on this volume.


According to an equiry on the geonode-users email list (thanks for helpfull answers to Ariel and Matthew), the following locations store the data, and will grow big over time.


In the following, a solution for each of these locations is given.

GeoNode/GeoServer data directory

$ sudo mkdir /media/data/geoserver
$ cd /media/data/geoserver
$ mkdir data
$ cd /usr/share/geoserver
$ sudo ln -s /media/data/geoserver/data/ data
$ sudo chown tomcat7:tomcat7 data -R

Upload directory

$ cd /var/www/geonode
$ sudo mv uploaded /media/data/geonode/
$ sudo ln -s /media/data/geonode/uploaded/ uploaded
$ sudo chown www-data uploaded -R

Tomcat temp (cache) dir

Tomcat will write the cached tiles of GeoNode's GeoWebCache instance, which can get very big, into the tomcat temporary folder. The path of the temporary directory is defined in an environment variable, which is configured in the tomcat init/startup script.

$ cd /etc/init.d
$ sudo nano tomcat7

Find the line


...change it to


Postgresql tablespace

The hardest part of the configuration is to change the file system locations of the postgresql database and its tables. At first we create a directory for the postgresql storage.

$ vmadmin@geonode:/media/data$ mkdir postgresql
$ sudo chown postgres postgresql/ -R
$ cd postgresql/
$ mkdir data
$ sudo chown postgres data/ -R

Next we set the table spaces:

$ sudo su postgres
$ psql
CREATE TABLESPACE exthd LOCATION '/media/data/postgresql/data';

ALTER DATABASE geonode SET default_tablespace = exthd;

\connect geonode

Alter the tables that grow big to new tablespace:

ALTER TABLE documents_document SET TABLESPACE exthd;
ALTER TABLE layers_attribute SET TABLESPACE exthd;
ALTER TABLE layers_layer SET TABLESPACE exthd;
ALTER TABLE layers_layer_styles SET TABLESPACE exthd;
ALTER TABLE layers_layerfile SET TABLESPACE exthd;
ALTER TABLE layers_style SET TABLESPACE exthd;
ALTER TABLE layers_uploadsession SET TABLESPACE exthd;
ALTER TABLE maps_maplayer SET TABLESPACE exthd;
ALTER TABLE maps_mapsnapshot SET TABLESPACE exthd;
ALTER TABLE services_service SET TABLESPACE exthd;
ALTER TABLE services_servicelayer SET TABLESPACE exthd;
ALTER TABLE services_serviceprofilerole SET TABLESPACE exthd;
ALTER TABLE services_webserviceharvestlayersjob SET TABLESPACE exthd;
ALTER TABLE services_webserviceregistrationjob SET TABLESPACE exthd;
ALTER TABLE upload_upload SET TABLESPACE exthd;
ALTER TABLE upload_uploadfile SET TABLESPACE exthd;

The tables are pure assumption, its possible to alter the tablespace of more tables later on, if further tables proof to store much data. Thats it, so far... until now everything runs as expected on the system, and the right locations store the data. I'll keep you posted if I need to adapt anything on the system.

Have fun!


comments powered by Disqus

blog comments powered by Disqus