.. _kernel-installation-debian:

Debian / Ubuntu
===============

:Authors: Nicolas Bozon, Gérald Fenoy, Jeff McKenna, Luca Delucchi
:Last Updated: $Date: 2011-12-07 13:19:47 +0000 (Wed, 07 Dec 2011) $

.. contents:: Table of Contents
    :depth: 2
    :backlinks: top

.. note::
   An Ubuntu 10.4 with ZOO virtual image is available at http://www.zoo-project.org/Ubuntu10.4_ZOO.zip
   (root: ZOO.test)

The following instructions were tested on Debian Squeeze, Ubuntu 10.04 and Ubuntu 10.10

Installation Workflow
---------------------

- install some dependencies

::

  sudo apt-get install flex bison libfcgi-dev libxml2 libxml2-dev curl openssl autoconf checkinstall

- download ZOO  source

::

  svn checkout http://svn.zoo-project.org/svn/trunk zoo-project

- install cgic from packages

::

  cd zoo-project/thirds/cgic206/

- compile

::

  make


- go to kernel path

::

  cd ../../zoo-kernel/

- create configure file

::

  autoconf

- run configure

::

  ./configure --with-java=/path/to/java
  ./configure --with-python

.. note::
   In Ubuntu 10.04 libmozjs-dev does not exist, so to use JavaScript you can compile SpiderMonkey (remember to put /usr/local/lib in a file inside /etc/ld.so.conf.d/). 
   For PHP, you must make sure to compile PHP with `--enable-embed <http://www.zoo-project.org/trac/wiki/ZooKernel/Embed/PHP#ConfigureandInstallPHPEmbedlibrary>`__.

- to use JavaScript with compiled SpiderMonkey.

::
   
  sudo echo "/usr/local/lib" > /etc/ld.so.conf.d/libmoz185.conf
  sudo ldconfig
  ./configure --with-js=/usr/local


- to use JavaScript with Xulrunner .

::
   
  sudo echo "/usr/lib/xulrunner-dev" > /etc/ld.so.conf.d/libmoz185.conf
  sudo ldconfig
  ./configure --with-js=/usr/lib/xulrunner-dev


- compile

::

  make zoo_loader.cgi

- copy necessary files into your cgi-bin

::

  sudo cp main.cfg /usr/lib/cgi-bin
  sudo cp zoo_loader.cgi /usr/lib/cgi-bin

- install ZOO ServiceProvider (in this case we try Python service)

::

  sudo cp ../zoo-services/hello-py/cgi-env/*.zcfg /usr/lib/cgi-bin
  sudo cp ../zoo-services/hello-py/*.py /usr/lib/cgi-bin/

- change some paths in the main.cfg

::

  sudo nano /usr/lib/cgi-bin/main.cfg
    - serverAddress = http://127.0.0.1
    - providerSite = http://127.0.0.1


- try the installation

  - http://127.0.0.1/cgi-bin/zoo_loader.cgi?ServiceProvider=&metapath=&Service=WPS&Request=GetCapabilities&Version=1.0.0
  - http://127.0.0.1/cgi-bin/zoo_loader.cgi?ServiceProvider=&metapath=&Service=WPS&Request=DescribeProcess&Version=1.0.0&Identifier=HelloPy
  - http://127.0.0.1/cgi-bin/zoo_loader.cgi?ServiceProvider=&metapath=&Service=WPS&Request=Execute&Version=1.0.0&Identifier=HelloPy&DataInputs=a=myname

.. note::
   If you have some problem in the execute request using Python service, add the following to ``main.cfg``: 

   ::
   
     [env]
     PYTHONPATH=<YOUR_PYTHONPATH>