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.

FIMEX (optional, but recommended)

While not stricly necessary, FIMEX is required for functionality regarding transformation and OPeNDAP. However, since it is not available via official Ubuntu repositories it is not a required dependency. You can find it on Launchpad (binaries) and in Subversion (source).

The remaining dependencies will be included automatically by apt. A complete list can be found in "debian/control".

Installation from Debian repository

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:

FIXME: add to sources.list.d via script!!!

  # for trusty
  deb http://repo.met.no/met.no trusty main contrib
  deb-src http://repo.met.no/met.no trusty main contrib
  
  # 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 trusty
  deb http://repo.met.no/devel trusty main contrib
  deb-src http://repo.met.no/devel trusty main contrib

  # 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

You also need to import the PGP key for repo.met.no to verify it:

  sudo apt-key adv --keyserver pgp.mit.edu --recv-keys ED4352662E4634B5

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 FIMEX

  $ sudo apt-get install fimex-bin

If repo.met.no is not available, please follow the instructions at Launchpad on how to add a PPA to your system.

Setting up automatic upgrades

This should enable unattended upgrades of all packages. Note that even though a METAMOD package is upgraded, you still need to restart the services manually (this cannot be automated since METAMOD has no idea how many instances you have created).

  sudo apt-get install unattended-upgrades
  sudo dpkg-reconfigure unattended-upgrades
  # Answered Yes

Installing packages manually

Alternately you may download the .deb files and install manually. This is not recommended as you will lose automatic upgrading. The packages 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.

Installing dependency libraries

The METAMOD Debian package already includes all necessary Perl dependencies, and pulls in any required binary libries automatically. Make sure CATALYST_LIB is unset in master_config.txt (this is only relevant when upgrading from 2.12 and earlier).

Testing METAMOD

Once you have installed METAMOD from source and compiled the binaries (alternatively installed both from a Debian package), you may want to test that the installation is working properly. The easiest way is to run the unit tests.

For the first time, you need to create the necessary test databases. This is done automatically by the short_test_application.sh script. There is no need to configure an application first as the test framework generates this for it's own need automatically.

  $ cd <installation_dir>
  $ test/short_test_application.sh

Once this has been run, you can rerun the unit tests directly:

  $ ./run_automatic_tests.pl

Installing Apache

Apache is probably installed by default on most servers, however to work with Catalyst you also need the proxy and rewrite modules. Look in /etc/apache2/mods-enabled to see if they have already been enabled.

  $ sudo a2enmod proxy
  $ sudo a2enmod proxy_http
  $ sudo a2enmod rewrite

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). These may reside on the same server as METAMOD, but in production environments are usually running on a separate database server (specified by PG_HOST in the config.)

Required software

The following Debian packets must be installed on the database server:

The simplest way to install all the above is using the virtual metamoddb package:

  $ sudo apt-get install metno-metamoddb-2.13

In addition if running a separate database server, 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

Unfortunately it is not possible to install these files via Debian automatically as a) the postgresql-client version may not be the same as the postgresql server, and b) it would drag in postgresql server as a dependency. 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 go to the end of the file and change local from "peer" to "trust" at the two places indicated below:

  # 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  <--- *** CHANGE THIS ***
  local   all             postgres                                trust

  # TYPE  DATABASE        USER            ADDRESS                 METHOD

  # "local" is for Unix domain socket connections only
  #local   all             all                                     peer  <--- *** AND THIS ***
  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.