MapServer

From Hiscom
Jump to: navigation, search

AVH3

This document assumes you are installing on Centos 4.4 server. The mapserv cgi program can be placed in apache or tomcat.

1. Install the following packages as root

  yum install gcc
  yum install gcc-c++
  yum install python
  yum install freetype-devel
  yum install libpng-devel
  yum install libpng10
  yum install libpng10-devel
  yum install libtiff-devel
  yum install zlib-devel
  yum install libjpeg
  yum install libjpeg-devel
  yum install curl-devel
  yum install gd
  yum install gd-devel
  yum install subversion

2. Download and install proj-4.6.0.tar.gz from ftp://ftp.remotesensing.org/proj

  tar xzfv proj-4.6.0.tar.gz
  cd proj-4.6.0
  ./configure
  make
  make install

3. Download and install gdal-1.3.1.tar.gz from ftp://ftp.remotesensing.org/pub/gdal

  tar xzf gdal-1.3.1.tar.gz
  cd gdal-1.3.1
  ./configure --with-ogr --with-png --with-libtiff --with-jpeg --with-gif
  make
  make install

4. Download and install mapserver 5.0.2

  tar xfvz mapserver-5.0.2.tar.gz
  ./configure --with-threads --with-proj --with-gdal=/usr/local/bin/gdal-config --with-ogr --with-gd --with-freetype
  make
  cp mapserv /var/www/cgi-bin/mapserv

5. run the following commands as root,

  echo "/usr/local/lib" >/etc/ld.so.conf.d/local.conf
  ldconfig

Put mapserver files in here:

  cd /var/www/html
  svn co https://www.sapac.edu.au/svn/sapac/avh/trunk/mapserver avh

Or copy from the binary distribution.

6. test map server and make sure you get the same output as the one below to verify that map server works

  /var/www/cgi-bin/mapserv -v
  MapServer version 4.6.2 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=FREETYPE SUPPORTS=WMS_SERVER SUPPORTS=THREADS INPUT=EPPL7 INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE

7. Alternatively, you can put the mapserv cgi into tomcat. Ref: http://tomcat.apache.org/tomcat-5.5-doc/cgi-howto.html

7.1 Enable cgi config in $TOMCAT_HOME/conf/web.xml by de-commenting the CGI section

   <servlet>
       <servlet-name>cgi</servlet-name>
       <servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
       <init-param>
         <param-name>debug</param-name>
         <param-value>0</param-value>
       </init-param>
       <init-param>
         <param-name>cgiPathPrefix</param-name>
         <param-value>WEB-INF/cgi</param-value>
       </init-param>
        <load-on-startup>5</load-on-startup>
   </servlet>

7.2 Put mapserv in $TOMCAT_HOME/webapps/ROOT/WEB-INF/cgi