Difference between revisions of "WCS Wrapper Installation LinuxOP"

From Earth Science Information Partners (ESIP)
Line 26: Line 26:
 
We recommend latest '''python 2.6.6''' from [http://www.activestate.com/activepython/downloads ActiveState Python download page] or [http://downloads.activestate.com/ActivePython/releases/2.6.6.17/ActivePython-2.6.6.17-linux-x86.tar.gz ActiveState Direct Download] or you can download from [http://www.python.org/download/releases/2.6.6/ official site].
 
We recommend latest '''python 2.6.6''' from [http://www.activestate.com/activepython/downloads ActiveState Python download page] or [http://downloads.activestate.com/ActivePython/releases/2.6.6.17/ActivePython-2.6.6.17-linux-x86.tar.gz ActiveState Direct Download] or you can download from [http://www.python.org/download/releases/2.6.6/ official site].
  
Other versions of python 2.6.x or 2.7.x may work, but python 3 won't yet.
+
Other versions of python 2.6.x or 2.7.x may work, but python 3.x won't yet.
  
 
Since PyNIO is a 32 bit library, get a '''32 bit''' python even if you have 64 bit machine. If requested, we will support 64 bit binaries too.
 
Since PyNIO is a 32 bit library, get a '''32 bit''' python even if you have 64 bit machine. If requested, we will support 64 bit binaries too.

Revision as of 09:55, December 14, 2010

Back to WCS Wrapper

Project on SourceForge

Questions and comments should go to sourceforge discussions, bug reports to sourceforge tickets. Urgent issues can be asked from Kari Hoijarvi 314-935-6099(w) or 314-843-6436(h)

Last updated 2010-12-13

Install as Root

While it's technically possible to install this package as an ordinary user, we recommend installing the shared libraries as an administrator.

Things to Consider About Security

The web.py framework and WCS service code has been written with security in mind, and there are no known security bugs. There is no code that writes on the disk, so running this service should not put your computer in danger.

To maximize the security of your computer, consider the following.

  • Every file in every directory you put under OWS/web/static becomes readable by anybody. This is by design, since the whole framework is meant to publish public data. Do not put confidential information under OWS folder!
  • Don't run the process as root. Create a low-rights account like WCS_RUNNER and use that.


Get Python 2.6.6

We recommend latest python 2.6.6 from ActiveState Python download page or ActiveState Direct Download or you can download from official site.

Other versions of python 2.6.x or 2.7.x may work, but python 3.x won't yet.

Since PyNIO is a 32 bit library, get a 32 bit python even if you have 64 bit machine. If requested, we will support 64 bit binaries too.

Install with command

   $ ./install.sh -I /usr/local

Warning: This will overwrite your existing python. It may or may not be OK to upgrade, but hardly good to downgrade. You can install several versions of python in the same machine and then edit your environment variables to use the desired version.

Get the Datafed WCS Wrapper

If you have modified the default OWS/web/static/index.html, make sure not to overwrite' it. Keep the main copy elsewhere and copy it back.

Open the download page in another tab.

If you are serving cubes from NetCDF files, get win32-ows-1.3.1.zip or later. This distribution contains point data support also. If you are serving only point data, you can just download ows-point-1.3.1.zip.

   ows-point-1.3.1.zip = (win32-ows-1.3.1.zip) - (netcdf support) + (sample point provider)

Unzip it/both into your installation folder OWS. You can install to other folders, this is just used as an example.

You will to have directories OWS/datafed and OWS/web

The folder datafed contains datafed package, which contains tools for ISO 8601 time parsing and some other utilities. Web is the WCS framework.

Notice:

Using C based libraries enables delivering large amounts of data efficiently. Python is used only for query parsing, making minimal impact in speed.

Although the built-in webserver is intended mainly for development, you can use it to serve data from your own workstation just fine. For high load sites, look webpy.org/install documentation how to integrate webpy with apache server etc.

Get 3rd Party Components

You should have easy_install in your python tools.

  • Install webpy 0.34 Webpy favicon.png by following instructions at webpy download, or just type
   easy_install web.py
   ./configure ; make ; make install

in both of the directories.

After that,

   easy_install lxml==2.2.8

compiled and installed the lxml library.

notes/before you begin

  • this package has been tested with Python 2.5 and should also run on version 2.6 without problems, 3.x is not supported yet
  • system-wide installation of packages will require root access to the system
    • it is theoretically possible to install all packages to a user directory, but it might be somewhat tricky and will not be covered here
  • for installation of 3rd party python packages it is recommended to use easy_install
    • download the installer file matching your Python version and execute it on a shell as instructed
  • 3rd party packages will receive updates over time. the last tested version of every package is noted below
  • all required packages except for PyNIO can be installed via easy_install, so don't bother to download them in advance
  • unfortunately you will have to jump through some hoops for PyNIO. check out the PyNIO/NGL download page for instructions on how to obtain and install it

required 3rd party software

You have to install the packages listed below first in order to run the OWS server. Use easy_install for all except PyNIO (see above)

  • webpy (0.32)
  • lxml (2.2.2)
    • might require additional development/header packages to be installed on your system (python-dev, libxml2-dev, libxslt1-dev, zlib1g-dev on Debian)
  • NumPy (1.3.0)
    • you should have a fortran compiler installed for that, for example gfortran on Debian
  • WsgiLog (0.1) (optional, only if you want to log webpy output to a file)
  • PyNIO (1.3.0b1)

install and start OWS server

  • get the OWS code package for Linux
  • unpack to your desired working directory, the contents of the archive will end up in ./ows
    • these instructions assume that your working directory is /usr/local/, so the package contents would end up in /usr/local/ows
  • add the path of the extracted ows directory to your PYTHONPATH environment variable
    • if you followed the above example, PYTHONPATH should contain /usr/local/ows
  • cd to ows/web and execute python ows.py
  • a server should be running on http://localhost:8080/ now
    • a different port can be passed to the server as an argument
    • you will have to create the log directory /var/log/ows before running the server for the first time
        • if the server is not being run as root, the user that runs it needs write access to the log dir
  • you can stop the server by pressing ctrl-c in the console window
  • to make the server available automatically at boot time, you can use an init script
    • an example script that starts the OWS server in a screen session as another user is available here

example installations

Debian

Creating Metadata

The metadata queries of WCS, GetCoverage and DescribeCoverage need to be precompiled.

Run the following commands:

cd /usr/local/OWS/web
python owsadmin.py wcs_prepare -o testprovider
or for all:
python owsadmin.py wcs_prepare -ao

-o is for optimize, -a prepares every provider

it will create file /usr/local/ows/web/static/testprovider/metadata.dat.

Try now test queries GetCapabilities and DescribeCoverage CubeA

Press ctrl+C to terminate the server. Although this server is intended for development and debugging only, you can use it to server data from your own workstation just fine. For high load sites, look webpy.org/install documentation how to set up a high load site.

Notice: WCS core functions are written in C/C++, enabling large amount of data delivery. Python is used only for query parsing, making minimal impact in speed.

The server returns a short XML document, which contains a link into the query result, you can download it by copying the url to your browser.

index.html Pages

If no query is present, the server gives a default page index.html. You should provide pages for your server and for all the providers.

The server is at /usr/local/ows/web/static/index.html, which will be displayed from url http://localhost:8080/

Every provider can have an own index.html like /usr/local/ows/web/static/testprovider/index.html which will be displayed from http://localhost:8080/testprovider

If you modify the default index.html, make sure not to overwrite it next time you upgrade the WCS Wrapper package. Keep the main copy elsewhere and copy it back.

Important! web.py development server requires, that text files have Unix-style end of line marker, plain LF and not the Windows convention CR-LF. The owsadmin.py script can be used to fix this:

python /usr/local/OWS/web/owsadmin.py unix_nl "/usr/local/OWS/web/static/testprovider/index.html"

Use your html editing tool support if possible.