Install the dependencies:
#apt install openjdk-8-jre-headless tomcat8 postgis
Using -headless
on openjdk-8-jre
is important because that prevents APT from
installing a whole desktop environment as a dependency.
Switch to the postgres user to configure your database
#su postgres
Create your database
$createdb -O postgres gn -E utf-8
Enable PostGIS and PostGIS topology on your database.
$psql -U postgres -d gn -c ‘CREATE EXTENSION postgis’ $psql -U postgres -d gn -c ‘CREATE EXTENSION postgis_topology’
Set a password on the postgres account.
$psql =#\password postgres
Download geonetwork.war version 3.44, outside the postgres account.
$exit $wget https://versaweb.dl.sourceforge.net/project/geonetwork/GeoNetwork_opensource/v3.4.4/geonetwork.war Make sure this is placed in /var/lib/tomcat8/webapps/, so Tomcat will now where to look for it.
From now on I will refer to /var/lib/tomcat8/ as “$TOMCAT”.
a. Comment out <import resource="../config-db/h2.xml"/>
b. Uncomment <import resource="../config-db/postgres-postgis.xml"/>
.
Change the values for jdbc.username
and jdbc.password
to match what you configured earlier.
unzip
. You may need to install unzip
, because gunzip
won’t work.tomcat8
Restart tomcat
#systemctl restart tomcat8.service
You may need to place some .jar files in $TOMCAT/webapps/geonetwork/WEB-INF/lib/ .
Now install nginx in order to use it to optimize and secure public requests to the Tomcat server.
#sudo apt install nginx
If you want you may test that this works by pointing your browser to this server, without specifying a port. You should get message telling you that nginx is running successfully.
/etc/nginx/sites-enabled/default
to tell it to pass requests on to Tomcat.Replace the location /
block with:
location / {
proxy_pass http://127.0.0.1:8080/;
}
Restart nginx.
#systemctl restart nginx.service