Installing GeoNetwork 2.4.2 under Tomcat with a MySQL Backend
Setup the MySQL Database for Geonetwork to Use
- From the command prompt on the instance, type the following commands:
mysqladmin create geonetwork -u root -p
You will be prompted for the password for the root MySQL user.
- Define a geonetwork MySQL user with permissions on the new database:
mysql -u root -p (enter password when prompted) grant all privileges on geonetwork.* to 'geonetwork'@'localhost' identified by 'password'; grant all privileges on geonetwork.* to 'geonetwork'@'159.87.39.14' identified by 'password';
- In order to populate the database for GeoNetwork's use, you'll need to have GAST installed on a remote machine at the IP address used in the "grant" line above. Using the GAST tool on that remote machine, you can connect to the MySQL database you just made using the geonetwork user, and use the Setup tool to add the tables and data that are needed.
- First, you'll want to make an install script that looks like this:
<AutomatedInstallation langpack="eng"> <com.izforge.izpack.panels.HelloPanel/> <com.izforge.izpack.panels.HTMLLicencePanel/> <com.izforge.izpack.panels.TargetPanel> <installpath>/mnt/data-store/geonetwork</installpath> </com.izforge.izpack.panels.TargetPanel> <com.izforge.izpack.panels.PacksPanel> <selected> <pack index="0"/> <pack index="1"/> <pack index="2"/> <pack index="3"/> </selected> </com.izforge.izpack.panels.PacksPanel> <com.izforge.izpack.panels.InstallPanel/> <com.izforge.izpack.panels.ShortcutPanel/> <com.izforge.izpack.panels.HTMLInfoPanel/> <com.izforge.izpack.panels.FinishPanel/> </AutomatedInstallation>
Note that you can specify the install location. You'll want it to be on the Elastic Data Store somewhere. - Create a directory for GeoNetwork to live, switch to it and download the executable .jar file to install it. Upload the install script to this directory as well.
mkdir /mnt/data-store/geonetwork cd /mnt/data-store/geonetwork wget http://downloads.sourceforge.net/project/geonetwork/GeoNetwork_opensource/v2.4.2/geonetwork-install-2.4.2-0.jar?use_mirror=softlayer
- Install Geonetwork with the following command:
java -DTRACE=true -jar geonetwork-install-2.4.2-0.jar <path to your install script>
Point GeoNetwork at the MySQL Backend
You'll be editing a file located at /mnt/data-store/geonetwork/web/geonetwork/WEB-INF/config.xml. Find the <resources> node and its children. Make the changes outlined below in bold:
<resources> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <!-- mckoi standalone --> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <resource enabled="false"> <name>main-db</name> <provider>jeeves.resources.dbms.DbmsPool</provider> <config> <user>xRgAPQLl</user> <password>X7ByXqvJ</password> <driver>com.mckoi.JDBCDriver</driver> <url>jdbc:mckoi://localhost:9157/</url> <poolSize>10</poolSize> </config> <activator class="org.fao.geonet.activators.McKoiActivator"><configFile>WEB-INF/db/db.conf</configFile></activator></resource> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <!-- mysql --> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <resource enabled="true"> <name>main-db</name> <provider>jeeves.resources.dbms.DbmsPool</provider> <config> <user>geonetwork</user> <password>password</password> <driver>com.mysql.jdbc.Driver</driver> <url>jdbc:mysql://localhost:3306/geonetwork</url> <poolSize>10</poolSize> <reconnectTime>3600</reconnectTime> </config> </resource>
Adjust GeoServer's Data Directory
GeoNetwork comes with a simple GeoServer installation that is used to draw the basemaps in the Intermap application. The default installation does not point GeoServer at the right place to find its data. Make the following change to /mnt/data-store/geonetwork/web/geoserver/WEB-INF/web.xml:
<context-param> <param-name>GEOSERVER_DATA_DIR</param-name> <param-value>/mnt/data-store/geonetwork/data/geoserver_data</param-value> </context-param>
Adjust GeoNetwork Folder Permissions
There's probably a more elegant way to handle this, but for now....
chown -R tomcat6:tomcat6 /mnt/data-store/geonetwork
Add Context Snippets for Tomcat
In /etc/tomcat6/Catalina/localhost, place three files:
geonetwork.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- configuration to point tomcat at geonetwork directory at root of file system --> <Context docBase="/mnt/data-store/geonetwork242/web/geonetwork" path="/geonetwork"></Context>
intermap.xml
<!-- configuration to point tomcat at intermap (map on the web interface for geonetwork; geoserver map client) directory at root of file system --> <Context docBase="/mnt/data-store/geonetwork242/web/intermap" path="/intermap"></Context>
geoserver.xml
<?xml version="1.0" encoding="UTF-8"?><!-- configuration to point tomcat at geoserver (WMS service etc.) directory at root of file system --> <Context docBase="/mnt/data-store/geonetwork242/web/geoserver" path="/geoserver"></Context>
Restart Tomcat
/etc/init.d/tomcat6 restart
- Login to post comments
Comments
Tomcat permission error due to missing Tomcat policy change
If you encounter a permission error in Tomcat, the following permission changes may fix it:
Add bold text to the end of the file:
Reboot Tomcat