Thursday, July 28, 2011

apache - mod python - tilecache: installation on minimal centos 4.6

my apache - mod_python - tilecache installation notes on minimal centos 4.6 (final)

1. from base system installation, install the ff:
glibc-kernel-headers
glibc-headers
glibc-devel
cpp
gcc

2. install apache
# ./configure -prefix=/usr/local/apache2 -enable-so -enable-rewrite -with-mpm=prefork
# make
# make install

3. install mod_python
http://www.apache.org/dist/httpd/modpython/mod_python-3.3.1.tgz
# ./configure --with-appxs=/usr/local/apache2/bin/apxs
(if you get an error: apxs not found or not executable, locate your apxs)

# make
make failed: [mod_python.so] Error 1

* install python from source to include libraries
download http://www.python.org/ftp/python/2.5.1/Python-2.5.1.tgz
# ./configure
# make
# make install

...continue mod_python installation
# ./configure --with-appxs=/usr/local/apache2/bin/apxs
# make
# make install

4. configure apache
# vi /etc/apache2/apache2.conf
add:
LoadModule python_module /usr/lib/apache2/modules/mod_python.so

5. test python
# vi /usr/local/apache2/conf/httpd.conf
add:
<Directory /usr/local/apache2/htdocs/pytest/>
 AddHandler mod_python .py
 PythonHandler test
 PythonDebug On
</Directory>

# test.py

from mod_python import apache

def handler(req):
          req.log_error('handler')
          req.content_type = 'text/plain'
          req.send_http_header()
          req.write('mptest.py\n')
          return apache.OK

6. install tilecache
download http://www.tilecache.org/tilecache-2.01.tar.gz
extract into your web directory
# python ez_setup.py
# python tilecache_install_config.py

7. configure apache for tilecache
# vi /usr/local/apache2/conf/httpd.conf
add:
AddHandler python-program .py
PythonHandler TileCache.Service
PythonOption TileCacheConfig /path/to/tilecache.cfg

<Directory /usr/local/apache2/htdocs/tilecache/>
    AddHandler python-program .py
    PythonHandler TileCache.Service
    PythonOption TileCacheConfig /usr/local/apache2/htdocs/tilecache/tilecache.cfg
</Directory>

<Location /mpinfo>
      SetHandler mod_python
      PythonHandler mod_python.testhandler
</Location>

8. test by browsing:
http://x.x.x.x/tilecache/tilecache.cgi?LAYERS=basic&SERVICE=WMS%20&VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG:4326&BBOX=-180,-90,0,90%20&WIDTH=256&HEIGHT=256

tada!

No comments:

Post a Comment

SSH : No matching host key type found. Their offer: ssh-rsa,ssh-dss

Got this while connecting to my mikrotik router via ssh   Unable to negotiate with <ip address> port <ssh port>: no matching hos...