In this post I will document my playing arround with mapserver. I'll do my best to update this as best I can, but consider this as on 'under construction status'...

Debian Lenny comes with version 5 of mapserver, so in order to install it you just need to type in the terminal as root:

apt-get install cgi-mapserver mapserver-bin mapserver-doc php-mapscript python-mapscript.

If you don't have apache2 running and configured than you should also install apache2.

In debian cgi-scripts are install by default to /usr/lib/cgi-bin but are linked to /cgi-bin in the default install of apache2 in debian.

The next step is to install the simple map server application from here. After you download the zip file, extract it and copy it to /var/www/. NOTE: The extract of the file creates a folder named workshop, I changed it mapserver. Hence after renaming and copying the folder, I now have an apache root folder and which lookes likethis:

/var/www/mapserver/

this folder has all the demo files and can be accessed from the web-browser by typing in the adress bar:

localhost/mapserver.

This will lauch the first mapserver application. However, since this demo was originaly compiled for different systems, we need to edit the files a little bit.

First we need to edit index.html to fit the setting of the debian system.

replace lines 9-10 with the following:

var snippet = "IMAGEPATH '/var/www/mapserver/tmp/'"; //where data is written

snippet += " IMAGEURL '/mapserver/tmp/'";

make sure you create tmp/ under mapserver/

change line 34 to the following:

<form name="demo" method="GET" action="../cgi-bin/mapserv"

onSubmit="configure()">

and lines 42-45 to:

<input type="hidden" name="map" value="/var/www/mapserver/itasca.map"> <input type="hidden" name="program" value="../cgi-bin/mapserv"> <input type="hidden" name="root" value="/mapserver">

now we need to edit itasca.map to the following:

#WMS_ONLINERESOURCE "http://localhost/mapserver/index.html".

Now when you direct your browser to 'localhost/mapserver/index.html' you should be able to see the produced maps.

note: originally published in my own little blog in the end of the web. http://www.tabula0rasa.org/?p=109 there a few more posts there about python and mapserver. You're most welcome to visit and comment.