There are different ways to set up a GeoNetwork metadata catalogue. The project comes with a platform independet installer (.jar) which can be used on Windows, Linux and Mac OS X platforms as well. It should install GeoNetwork and Geoserver, uses Jetty as servlet container and h2 as database (though another database can be configured).
There is also the option to use the .war archive with the h2 database. In case you come here frustrated by this approach: the most common problem seems to be, that the default h2 database location /var/lib/tomcat7 is not writable by the tomcat user and therefore the location has to be changed to a writable location as described for GeoNetwork 2.x for example here).
The following guide describes how to set up GeoNetwork without Geoserver on an Ubuntu 14.04 LTS server with Tomcat7 and a PostgreSQL database.
The minimum specs are lower but - trust me - together with Tomcat and Postgresql you really want to have at least 2 cores and 2 GB of ram.
Though the GeoNetwork installation guide still states "JRE 1.6.0" - in times of Java8 - you don't want to do go with the outdated 1.6 version. At the time of writing OpenJDK7 is the default version in the repository and to my experience/knowledge it works just as well as Oracle/SUN Java:
sudo apt-get install openjdk-7-jre-headless
Install Tomcat with:
sudo apt-get install tomcat7 tomcat7-admin
Now you should configure the users - removing the default ones and add the ones you need. To be more specific: we need a role with "manager-gui" and a user with this role to be able to use the manager gui.
sudo vi /var/lib/tomcat7/conf/tomcat-users.xml
<tomcat-users> <role rolename="manager-gui"/> <user username="youUserName" password="yourPassword" roles="manager-gui"/> </tomcat-users>
Now we can use elinks to download the .war archive from:https://sourceforge.net/projects/geonetwork/files/GeoNetwork_opensource/
Opening the tomcat manager gui in a browser we can easily deploy the .war file.
To get a better performance for your application you should grant Tomcat more ressources:
sudo vi /etc/default/tomcat7
in JAVA_OPTS you should
Next you can set a higher value for maxThreads. A rule of thumb is to set the value x200 times the number of cores:
sudo vi /etc/tomcat7/server.xml
Add to the <connector> for a server with two cores:
As database we choose PostgreSQL which can be used for a bunch of other GIS applications as well.
sudo apt-get install postgresql postgis*
In Ubuntu 14.04: Don't forget the asterisk after postgis - otherwise you will miss some postgis packages. For other distros this might not be necessary.
After installation check the services if postgreSQL is up an running:
service postgresql status
Now start your database session with psql:
sudo -u postgres psql
and set a new password:
leave psql with
Now about the configuration:
sudo vi /etc/postgresql/9.3/main/postgresql.conf
search for shared buffers:
and set a higher value (e.g. 512 or 1024). Here is also the location where you set the listen_addresses of your database. I really would advise you to keep the setting "localhost" if your server is available on the internet.
Anyways - after setting shared_buffers restart PostgreSQL:
sudo service postgresql restart
Now let's configure the authentication settings:
sudo vi /etc/postgresql/9.3/main/pg_hba.conf
You have to allow login with encrypted password by generating a local "md5" entry (the database will be only accessible from the server with the local setting).
You can either change the line
local all all peer
local all all md5
Or add a new line in the end of the file where you explicitly specify your database and user, e.g.
local geonetwork geonetwork md5
"geonetwork" because for this howto I used geonetwork as database user and database name - but feel free to pick something more suiitable
Details about the pg_hba.conf are explained here
Afterwards let's reconnect with psql to PostgreSQL to create a new database for GeoNetwork:
sudo su postgres
CREATE USER geonetwork WITH PASSWORD 'yourPassword';
CREATE DATABASE geonetwork WITH OWNER = geonetwork ENCODING 'UTF8';
psql -d geonetwork -c "CREATE EXTENSION postgis;"
psql -d geonetwork -c "CREATE EXTENSION postgis_topology;"
Now let's connect the newly created database!
sudo vi /var/lib/tomcat7/webapps/geonetwork/WEB-INF/config.xml
Here we have to disable the default h2 database container by setting it to: enabled="false".
Also we have to add a new ressource for our PostgreSQL database:
More information can be found here.
As Ernest Chiarello pointed out the configuration file has been split up since GeoNetwork 3.0. (Many thanks Ernest!) Here is his description of the new configuration settings.
In the srv.xml file the database resource has to be set to postgres.xml and the h2 option commented out.
sudo vi /var/lib/tomcat7/webapps/geonetwork/WEB-INF/config-node/srv.xml
If you are running the postgresql database on a different port you also might want to have a look at the postgres.xml file.
sudo vi /var/lib/tomcat7/webapps/geonetwork/WEB-INF/config-db/postgres.xml
The configuration of your connection settings is done in the jdbc.properties files:
sudo vi /var/lib/tomcat7/webapps/geonetwork/WEB-INF/config-db/jdbc.properties
Now your GeoNetwork should be ready to go - so lets start it from Tomcats manager gui and afterwards check:
Otherwise the stacktrace displayed hopefully gives you some good pointers where to look :) But don't worry: this is GeoNetworks way to communicate with you.
GeoNetwork gives you rich possiblities for configuration. Some of them should be set right from the beginning:
Login as admin (password admin) to GeoNetwork:
Have a look at this how-to in case you are interested in inserting metadata records via the CSW interface using a Python script.
You might also be interested in my (unfortunately not completed) guide about hardening your Ubuntu Server.
I'm really happy about feedback! In case you got suggestions how to improve this guide, just let me know: ed.rutkafunamnetadoeg@tkatnok