METAMOD software installation

Back to Index

########################

Introduction

This describes how to install the METAMOD software on a Linux server. No services will be available until you configure and set up a METAMOD instance (see Deploying a METAMOD application) as well as a database instance.

METAMOD is developed, tested and used on Ubuntu LTS servers (Hardy, Lucid, Precise). Debian packages are provided regularly for easy installation and upgrading. Installation from source is also possible, but somewhat more time-consuming.

########################

Required software

PostgreSQL database system

The current version requires PostgreSQL 9.1 or later. It has also been tested on version 8.3 and 8.4, but some features may not work (in particular some PostGIS projections required for dynamic map search may be missing). If running a local database you need the PostgreSQL server, otherwise only the client is required.

Apache 2.x web server

With mod_proxy, mod_proxy_http and mod_rewrite installed

libxml and libxslt library

From xmlsoft.org

Proj4 library

http://proj.maptools.org

NetCDF software 3.5 or later

libnetcdf, ncdump and ncgen

########################

Installation from Debian packages

This requires you have sufficient sudo privileges to install packages and add repositories.

Adding the met.no package repository

Note: Currently this repo is not available outside met.no. External users must download and install packages manually as described below.

Add the corresponding lines to your /etc/apt/sources.list depending on your version of Ubuntu:

  # for precise
  deb http://repo.met.no/met.no precise main contrib
  deb-src http://repo.met.no/met.no precise main contrib

  # for lucid
  deb http://repo.met.no/met.no lucid main contrib
  deb-src http://repo.met.no/met.no lucid main contrib

  # for hardy
  deb http://repo.met.no/met.no hardy main contrib
  deb-src http://repo.met.no/met.no hardy main contrib

If you want to run development versions (recommended), also add:

  # for precise
  deb http://repo.met.no/devel precise main contrib
  deb-src http://repo.met.no/devel precise main contrib

  # for lucid
  deb http://repo.met.no/devel lucid main contrib
  deb-src http://repo.met.no/devel lucid main contrib

  # for hardy
  deb http://repo.met.no/devel hardy main contrib
  deb-src http://repo.met.no/devel hardy main contrib

Installing METAMOD via apt

  $ sudo apt-get install metno-metamod-2.13

Note that the Perl dependencies package metno-perl-webdev-ver1 has been obsoleted from 2.13 onwards. Instead all Perl dependency libraries are now included in the Metamod package.

Installing packages manually

Alternately you may download the .deb files and install manually. These may be found on the following sites:

Installation is done using a GUI packet manager or via command line:

  $ sudo dpkg -i metno-metamod-2.13_2.13.0-1_amd64.deb

where 2.13.0-1 is the latest version in the repository.

########################

Installation from source

Download the METAMOD source code

Check out the METAMOD source code from Subversion into a suitable directory:

  $ mkdir metamod
  $ cd metamod
  $ svn co https://svn.met.no/metamod/trunk

A tar.gz file may also be available at a later date.

Installing binary dependencies

METAMOD depends on several non-Perl compiled utilities and libraries which must be installed separately, including:

Installing these via Debial packages using apt-get is recommended if possible. A complete list of the required Debian packages can be found in debian/control.

########################

Installing Perl dependency libraries

The METAMOD Debian package already includes all necessary Perl dependencies, and pulls in any required binary libries automatically. All you need to do is make sure CATALYST_LIB is unset in master_config.txt.

If installing from source, you must download and build the necessary Perl modules from CPAN. This used to be a major chore, but is now possible to do with a single command using the new Perl module dependency manager Carton.

cpanminus

First, you need to be able to install Perl modules from CPAN. There are several tools available for this, but we recommend using cpanminus which can be installed using either of the following commands:

  $ apt-get install cpanminus                               # for Debian systems
  $ curl -L http://cpanmin.us | sudo perl - App::cpanminus  # from source

Carton

Carton automatically downloads and builds the required METAMOD Perl dependency modules. Unlike cpan it will install the exact same module versions every time, avoiding upgrade conflicts and making sure you have the same environment as have been tested.

Carton is currently in beta development, and a regular install from CPAN may not give you the latest version. We recommend checking the latest version on the CPAN page and installing it explicitly:

  $ cpanm -S MIYAGAWA/carton-v0.9.15.tar.gz  # or whichever version is the latest

METAMOD dependencies

You are now ready to install the Perl dependency libraries:

  $ cd ~/metamod/trunk
  $ carton install --deployment

Carton will then install the modules listed in carton.lock into ~/metamod/trunk/local/lib. This should not generate any errors as long as you have installed all the necessary binary libraries as listed above.

PERL5LIB

Make sure that CATALYST_LIB is not set in master_config.txt, and your PERL5LIB environment variable is set to point to your local/lib/perl5 directory. This is handled automatically by activate_env and init.d scripts.

Alternate installation methods

As usual you could always install the required modules directly from CPAN. However, if you decided to install them outside your normal @INC path you need to specify the location in CATALYST_LIB in master_config.txt, as well as in PERL5LIB when running from the command line (activate_env doesn't handle this special case yet).

########################

Installing the PostgreSQL database

METAMOD requires two databases, one for metadata (which is just an index and can be recreated from the XML files) and one for user credentials (which is authorative and must be backed up).

Required software

The following Debian packets must be installed on the server:

In addition, the following files must be copied to the METAMOD application server and configured in PG_POSTGIS_SCRIPT and PG_POSTGIS_SYSREF_SCRIPT so that createdb.sh can read them:

  /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql
  /usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql

This will hopefully be resolved more elegantly in a later version.

Authentication (FIXME)

If running PostgreSQL on the same server as METAMOD, password authentication is not necessary for local connections. Instead you can configure PostgreSQL to automatically accept connections using sockets instead of TCP/IP by editing pg_hba.conf (replace 9.1 with correct version):

  $ sudo $EDITOR /etc/postgresql/9.1/main/pg_hba.conf

Then change local from "peer" to "trust" at the end of the file:

  # DO NOT DISABLE!
  # If you change this first entry you will need to make sure that the
  # database superuser can access the database using some other method.
  # Noninteractive access to all databases is required during automatic
  # maintenance (custom daily cronjobs, replication, and similar tasks).
  #
  # Database administrative login by Unix domain socket
  #local   all             postgres                                peer
  local   all             postgres                                trust

  # TYPE  DATABASE        USER            ADDRESS                 METHOD

  # "local" is for Unix domain socket connections only
  #local   all             all                                     peer
  local   all             all                                     trust
  # IPv4 local connections:
  host    all             all             127.0.0.1/32            md5
  # IPv6 local connections:
  host    all             all             ::1/128                 md5
  # Allow replication connections from localhost, by a user with the
  # replication privilege.
  #local   replication     postgres                                peer
  #host    replication     postgres        127.0.0.1/32            md5
  #host    replication     postgres        ::1/128                 md5

Then restart PostgreSQL:

  /etc/init.d/postgresql stop
  /etc/init.d/postgresql start

Alternatively, use .pgpass (FIXME)

########################

Conclusion

You will now have the necessary software installed, however it will not run until you configure and set up a METAMOD application. See configuration and deploying for further instructions.