A short how-to install pyWPS and serve data and processes. These instructions assume that you are working with a Debian 6 OS. For more info please also refer to the pyWPS homepage.

Edited by: H.I. Reuter

To install pyWPS, start by the latest version of the software from the server:

apt-get update

Next, install Webserver, GDAL, Scipy, etc. Start by installing Apache and Python:

apt-get install python gdal-bin python-gdal python-scipy apache2
apt-get install python-htmltmpl python-xml python-magic

Some of the above listed packages, depending on the library, might not install in one go, hence it is good idea to check that all installation was successful.

We can now create a directory to put the pyWPS installation:

mkdir /op/install

and change to that directory

cd /opt/install

Next, download the pyWPS installer.

wget https://svn.osgeo.org/osgeo/livedvd/gisvm/trunk/bin/install_pywps_svn.sh

If you are missing wget, you can try to get it via apt-get:

apt-get install wget

Before installing pyWPS, you need to change permission (to get help files under unix use the man command, e.g. man chmod):

chmod 700 install_pywps_svn.sh

You can also get the latest svn version of pyWPS:

svn checkout https://svn.wald.intevation.org/svn/pywps/trunk

It is recommended that you install the wps without actually touching anything for test purpose:

cd trunk
python setup.py install --dry-run
python setup.py install

If R functionality in python will be required, then install also rpy2 etc:

apt-get install libgdal1-dev r-base-dev
apt-get install python-rpy2

In the final step, check that the pyWPS server is running by executing

/usr/bin/wps.py

We want to make sure that the cgi-bin file is configured correctly in the apache installation:

edit /etc/apache2/sites-avaiable/default

and add

AddHandler cgi-script .cgi

To make sure everything is fine, first restart Apache:

/etc/init.d/apache2 reload

Try if http://your-ip or domain name/pywps/pywps.cgi? is working: in /var/www/pywps/ edit index.html and replace localhost with your your-ip or domain name:

http://your-ip

or

http://domainname.org/pywps/

In /var/www/pywps edit pywps.cfg and replace localhost with your your-ip or domain name. Make sure that the folder names for server names etc. are correct. Copy your pywps script(s) to:

/var/www/pywps/processes/

Do not forget that filename and name inside the file must be the same (!). Next, add in /var/www/pywps/processes/ in the init.py the appropiate filename without .py extension

/etc/init.d/apache2 reload

Current trunk version on debian has some errors with templates. So on install do:

chmod -R 777  /usr/local/lib/python2.6/dist-packages/pywps/Templates

Execute all functions at least once (e.g. getcapability, execute, etc.) and afterwards change it back to

chmod -R 555 /usr/local/lib/python2.6/dist-packages/pywps/Templates

To test that pyWPS is working, try opening in your browser:

http://YOUR-IPorYOURDOMAIN NAME/pywps/pywps.cgi?&version=1.0.0&service=WPS&request=GetCapabilities
http://YOUR-IPorYOURDOMAIN NAME/pywps/pywps.cgi?service=wps&version=1.0.0&request=execute&identifier=YOURPROGRAM&datainputs=[YOURDATAINPUTS]

If you experience any errors, it might be helpful to look at the logs written in /var/error/apache2/error.log:

tail -f /var/log/apache2/error.log

Remember to restart Apache server from time to time and look at the error messages, e.g. script not loaded etc.

Uploading data

To add images to be served, first make a directory:

mkdir /opt/worldgrids
cd /opt/worldgrids

Next, upload your data using SCP/SFTP/WGET to that directory, and make proper permissions using chmod (!).

Install Functions

To install functionality, simply copy the Python scripts:

copy subset.py; sampler.py /var/www/pywps/processes/

etc. into /var/www/pywps/processes/ add in /var/www/pywps/processes/ in the init.py the appropiate filename without .py extension. Then reload the Apache server:

/etc/init.d/apache2 reload

Check that it behaves like on your development maschine. Sometimes GDAL / pyWPS / R-project version differ and create slighly different results.

Happy WPSs!