- Debian jessie 8.7
- Apache 2.4.10
- Apache Tomcat 7.0.56
- JVM openJDK version "1.8.0_121"
- GeoNetwork 3.2.1
- PostgreSQL 9.4
- PostGIS 2.1
Before installing new packages it is recommended to update repositories.
$ sudo apt-get update
Install with command
$ sudo apt-get install apache2
Open in browser http://localhost or http://my-domain-name. You should see the contents of the index.html file (located in /var/www/html).
Check apache version
$ /usr/sbin/apache2 -v
Server version: Apache/2.4.10 (Debian)
Server built: <Date> <Time>
Configuration for a new site will be created from the modified default apache file which can serve as a backup. Copy file /etc/apache/site-available/000-default.conf
$ sudo cp -a /etc/apache/site-available/000-default.conf /etc/apache/site-available/geonetwork.conf
Now edit the file
$ sudo nano /etc/apache/site-available/geonetwork.conf
Add two lines inside the section <Virtualhost>.
ProxyPass / http://localhost:8080/geonetwork
ProxyPassEnable / http://localhost:8080/geonetwork
Enable the geonetwork site on apache server :
$ sudo a2ensite geonetwork
$ sudo service apache2 reload
Once finished with the Database configuration chapter the site will become functional.
In Debian jessie openJDK 1.7 will be installed by specifying
default-jrewhen executing the installation command. The version will be
java version "1.7.0_121"
Java 8 is required for GeoNetwork 3.2.x. Therefore the debian packports repository needs to be added in the repositories list.
In the /etc/apt/sources.list add the line below (or optionally create a new file my-jessie-sources.list in /etc/apt/sources.list.d/ and insert it here instead).
deb http://ftp.debian.org/debian jessie-backports main
more @ debianorg
Update the repository sources list.
$ sudo apt-get update
To install the correct version run :
$ sudo apt-get -t jessie-backports install openjdk-8-jre
and check the java version.
$ java -version
openjdk version "1.8.0_121"
OpenJDK Runtime Environment (build 1.8.0_121-8u121-b13-1~bpo8+1-b13)
OpenJDK 64-Bit Server VM (build 25.121-b13, mixed mode)
Install with :
$ sudo apt-get install tomcat7
Verify tomcat version :
$ sudo /usr/share/tomcat7/bin/version.sh
Using CATALINA_BASE: ...
Using CATALINA_HOME: ...
Using CATALINA_TMPDIR: ...
Using JRE_HOME: ...
Using CLASSPATH: ...
Server version: Apache Tomcat/7.0.56 (Debian)
...
If the command does not output the result above, verify if tomcat is up and running. Opening the URL http://localhost:8080/ in browser should respond with the message "It Works !" with the rest of the default page in tomcat's ROOT folder.
In case you receive a "Can’t establish a connection to the server at localhost:8080." that means tomcat server has not started properly.
Start the tomcat service :
$ sudo service tomcat7 start
Allocating memory resources while tomcat service starts up will allow GeoNetwork to launch correctly. The heap size is set by passing appropriate parameters to CATALINA_OPTS variable using a script, defining tomcat's environment.
more @ geonetwork documentation
Change directory to /usr/share/tomcat7/bin/ and create the file setenv.sh with the contents below to adjust the variable parameters :
$ sudo cat > setenv.sh
CATALINA_OPTS="$CATALINA_OPTS -Xms256m -Xmx1024m -XX:MaxPermSize=512m"
<Ctrl+D>
> see terrance's example script for other details
The script has to be an executable file.
$ sudo chmod +x setenv.sh
$ sudo service tomcat7 restart
Start deploying GeoNetwork by downloading geonetwork.war :
$ cd ~
$ wget "geonetwork download link *"
* https://sourceforge.net/projects/geonetwork/files/GeoNetwork_opensource/v3.2.1/geonetwork.war
Copy the downloaded file to the webapps folder /var/lib/tomcat7/webapps.
s sudo cp -a geonetwork.war /var/lib/tomcat7/webapps
Tomcat will deploy the file in /var/lib/tomcat7/webapps/geonetwork. You might have to restart the tomcat service for the changes to take effect.
$ sudo service tomcat7 restart
Externalising the data directory is recommended to simplify the application upgrades.
see geonetwork documentation
However, if you are is not required to modify meta-data schemas keeping them in the default directory is probably the best choice as they update with each geonetwork version upgrade.
see geonetwork mailing list and documentation
Externalising is achieved by adding new parameters in the variable CATALINA_OPTS.
- -Dgeonetwork.dir for data directory
- -Dgeonetwork.schema.dir for schemas
- and as well as -Dgeonetwork.codelist.dir for thesaurus
The content of setenv.sh should now be :
CATALINA_OPTS="$CATALINA_OPTS -Xms256m -Xmx1024m -XX:MaxPermSize=512m -Dgeonetwork.dir=/usr/share/tomcat7/gn_data_dir -Dgeonetwork.schema.dir=/var/lib/tomcat7/webapps/geonetwork/WEB-INF/data/config/schema_plugins"
The folder **gn_data_dir ** is the location where geonetwork saves the details about configuration, metadata and resources, search functionalities and optionally spatial data information [1].
On linux systems users do not have writting permissions for system files and folders, except for the folder /home/<user>. Granting writing permissions is covered in the database configuration chapter as the database will be placed outside the geonetwork default location for the same reason - easier integration in case of application version update.
[1]: http://geonetwork-opensource.org/manuals/trunk/eng/users/maintainer-guide/installing/customizing-data-directory.html#structure-of-the-data-directory
H2 is a default GeoNetwork database, instantiated at the first launch. GeoNetwork will probably not start due to restriction of the writing permissions in the folder /var/lib/tomcat7.
more info @ mailling list and geonetwork github
The error can be inspected in geonetwork.log file located in /var/lib/tomcat7/logs/.
Tomcat's installation folder permissions can be changed, but it is safer to keep the ownership as root. Better option would be to use a directory such as /usr/share/tomcat7/.geonetwork.
Webapps running in tomcat server are executed and handled by the tomcat user and writing to the chosen location is possible by granting proper permissions to tomcat's home directory :
$ sudo chgrp tomcat7 /usr/share/tomcat7
$ sudo chmod g+w /usr/share/tomcat7
Accordingly, the database location has to be configured in jdbc.properties file found in /webapps/geonetwork/WEB_INF/config-db/. Modify the parameter jdbc.database to :
jdbc.database=~/.geonetwork/geonetwork
more @ gis stex
At this point the geocatalogue should be properly configured and ready for metadata exchange. Try if everything works as planned @ http://localhost or http://my-domain-name.
Geonetwork database connection and database node configuration is managed in 2 principal configuration files. Next section describes how to plug an external DBMS such as PostGreSQL.
Install PostGreSQL.
$ sudo apt-get update
$ sudo apt-get install postgresql-9.4
If you're getting "perl: warning: Setting locale failed." errors while installing packages the postgresql installation on a debian remote server may fail. These guides should be taken in consideration.
The working solution for this installation was "Stopping forwarding locale from the client". The line SendEnv LANG LC_* in the local /etc/ssh/ssh_config file was commented out.
The command below should display if the installation was successful.
$ ps -ef | grep postgre
Return the postgres status to see if the service is running.
$ sudo service postgres status
9.4/main (port 5432): online
Folow the PostgreSQL how to notes to set up a database user and the connection information details.
Now the database node can be configured properly for PostgreSQL. Open the srv.xml file in /var/lib/tomcat7/webapps/geonetwork/WEB-INF/config-node
$ sudo nano srv.xml
and comment out h2 and set postgresql node or change the connection information :
<!-- <import resource="../config-db/h2.xml"/> -->
<import resource="../config-db/postgres.xml"/>Then modifiy the connection information in the jdbc.properties file :
jdbc.username=<postgresql_username>
jdbc.password=<postgresql_password>
jdbc.database=<postgresql_databasename>
GeoNetwork will from now on use the PostGreSQL DBMS.
PostGIS spatial component is recommended to assure good database performance having large quantities of metadata in the catalogue.
$ sudo apt-get install postgis
more @ geo-solutions
Next chapters will describe certain migration scenarios. Soon more to come ...