PrimaGIS Buildout

The PrimaGIS buildout system -- primagis.buildout -- provides a mechanism for easily creating fully isolated sandboxes that run PrimaGIS. The buildout scripts will compile all the necessary components from source, starting from the Python interpreter and going all the way to Plone and PrimaGIS. The PrimaGIS dependency stack is quite deep and may prove hard to setup. The buildout system is meant to rectify this and is recommended for new users.

The buildout is based on Chris McDonough's excellent buildit system.

Bovorn Siriampairat has also written a detailed document (with screenshots) on using primagis.buildout. See http://iwsea.org/primagis_installguide1 for details.

Dependencies

The buildout has few depencies:

  • Buildit 0.1
  • Python 2.3+
  • Subversion
  • CVS
  • wget
  • C/C++ compiler
  • tar / gzip / bzip2 / unzip
  • zlib (both libraries and headers)
  • flex
  • yacc (or bison)
  • sed

The system Python is used to run the buildout system, but a custom Python version suited for PrimaGIS will be installed in the sandbox.

On a Debian based system you run the following command to get the necessary packages installed:

 $ sudo apt-get install build-essential flex bison sed bzip2 zlib1g \
   zlib1g-dev unzip gzip wget python subversion tar cvs

Installation

You can download the buildit system from

http://www.agendaless.com/Members/chrism/software/buildit/buildit-0.1.tar.gz

If you have setuptools installed, you can use easy_install to install buildit:

  $ easy_install http://www.agendaless.com/Members/chrism/software/buildit/buildit-0.1.tar.gz

Buildit needs to somewhere in your PYTHONPATH so it will be found when the buildout is executed. After installing you can test this in your python interpreter by doing:

>>> import buildit

To get primagis.buildout you need to do a checkout from our subversion repository.

$ svn checkout http://svn.gispython.org/svn/zope/primagis.buildout/trunk primagis.buildout

Executing the buildout

The buildout system is able to produce two different environments: the current stable version and the development version. By default, the stable version is built.

To execute the buildout successfully, the system needs to configured with two filesystem locations:

  • build_root -- All components will be downloaded and compiled under this location
  • prefix -- All components will be installed under this location

You can provide these locations using command line switches. Below is the output of running python build.py --help which explains the different options:

$ python build.py --help
usage: build.py [options]

options:
  -h, --help            show this help message and exit
  --develop             Installs the development versions of PrimaGIS
                        components. By default the current stable version is
                        built.
  --build-root=BUILD_ROOT
                        Overrides the default build root. The BUILD_ROOT is
                        where all the source packages will be downloaded and
                        compiled in.
  --prefix=PREFIX       Overrides the default installation prefix. All
                        components will be installed under PREFIX.
  --quiet               Prevent the results from being shown.
  --zope-port=ZOPE_PORT
                        Zope HTTP server port number. Defaults to 8080.
  --postgresql-port=POSTGRESQL_PORT
                        PostgreSQL port number for local connections. Defaults
                        to 5432.

To get a stable version installed with default port settings you can simply run

$ python build.py --build-root=/path/to/build/root --prefix=/path/to/installation/prefix

Don't run the script as root (or using sudo) because the PostgreSQL installation scripts will fail otherwise. It is enough that the user the script is run as has write access to the build root and prefix locations. As long as the installation prefix is not a system location (such as /usr) the buildout is totally sandboxed from your existing system.

The buildout process may take a while so remember to be patient :) Below are some runtimes (excluding download time) I experienced on my systems:

  • ~30 minutes on a Linux system running a Pentium M 2.0 GHz
  • ~40 minutes on a OS X system (MacBook?) running a Intel Core Duo 2.0 GHz

Once the buildout process is finished you are ready to fire up Zope and start using PrimaGIS!

See README.txt and instructions printed by the buildout script after a successful run for further information.

System specific notes

Some systems may require some extra configuration/work for the buildout to work. Please add such information here!

Security Enhanced Linux (SELinux)

The buildout needs to be able to load dynamic libraries from non-system locations. With SELinux in enforcing mode this is not possible and needs to be explicitly allowed. If you see messages similar to the one below in your system logs then you are affected by this.

Nov 12 14:30:27 XXXXXX kernel: audit(1163363427.393:31): avc:  denied
{ execmod } for  pid=8742 comm="python2.4" name="libgdal.so.1.10.0"
dev=dm-0 ino=49451046 scontext=root:system_r:unconfined_t:s0-s0:c0.c1023
tcontext=user_u:object_r:usr_t:s0 tclass=file

You can go around this by running (as root) the following

$ sudo setsebool allow_execmod=1

And optionally revert the changes when needed by running

$ sudo setsebool allow_execmod=0

Fedora Core 6 is known to install with SELinux in enforcing mode. Thanks to David Mackay for providing this information.

List of components

The buildout installs the following components. See the individual INI-files for the exact version numbers.

  • termcap
  • readline
  • Python
  • libpng
  • libgif
  • libjpeg
  • libtiff
  • freetype
  • libgd
  • Python Imaging Library (PIL)
  • SWIG
  • cURL
  • libxml2
  • libxslt
  • lxml
  • simplejson
  • PROJ.4
  • GEOS
  • GDAL/OGR
  • PostgreSQL
  • PostGIS
  • psycopg2
  • MapServer?
  • OWSLib
  • Quadtree
  • Python Cartographic Library (PCL)
  • Zope
  • Plone
  • Cartographic Objects for Zope (ZCO)
  • PrimaGIS
  • ATColorPickerWidget
  • Bitstream Vera fontset
  • World borders data set (from mappinghacks.com)