Changes between Initial Version and Version 1 of LightSpeedMapServer


Ignore:
Timestamp:
Jul 29, 2010, 12:27:41 AM (14 years ago)
Author:
hellonishad
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • LightSpeedMapServer

    v1 v1  
     1
     2== Light Speed Map Server ==
     3
     4
     5This is a configuration of Map Server WMS as fast-cgi module of Lighttpd. Here I am compiling all main software packages from the source code on a 64bit Linux operating[[BR]]
     6system to get maximum performance. I hope my readers having experience in installing & configuring software packages under Linux platform. I prefer a CentOS 5.4 ×86_64 Linux [[BR]]
     7minimal server installation, because it is quite stable for me so far.
     8[[BR]]
     9''Prerequisites''
     10[[BR]]
     11Make sure that you have installed the following packages, normally it comes with the operating system installation.
     12{{{
     13cc gcc-c++ python python-devel krb5-devel readline-devel make swig pcre-devel libpng libpng-devel
     14bzip2-devel fontconfig fontconfig-devel libxml2-devel penssl-devel
     15curl-devel giflib-devel zlib-devel gettext libjpeg-devel libtiff-devel
     16}}}
     17If any of the package is not installed, install it by using YUM. For example if gcc is missing
     18{{{
     19yum install gcc-c++
     20}}}
     21Ok, let’s start with the main software packages installation for Map Server,[[BR]]
     22'''PostgresSQL'''[[BR]]
     23The world’s most advanced open source database server.I prefer PostgresSQL server to store the vector map data, for fast searching and rendering of WMS map tiles.
     24[[BR]]Download the source[http://www.postgresql.org/][[BR]]
     25Installation & Configuration.[[BR]]
     26{{{
     27tar -xzf postgresql-8.4.2.tar.gz
     28cd postgresql-8.4.2/
     29./configure —prefix=/usr/local/pgsql —with-perl —with-python —with-krb5
     30make
     31make install
     32adduser postgres
     33mkdir /var/lib/pgsql
     34chown -R postgres /var/lib/pgsql
     35su postgres
     36/usr/local/pgsql/bin/initdb -D /var/lib/pgsql/data
     37/usr/local/pgsql/bin/postgres -i -h localhost -p 5432 -D /var/lib/pgsql/data &
     38}}}
     39Now your PostgreSQL server is up and running. If you need an init.d startup script, download it from here [http://nishad.us/docs/softwares/postgresql.txt][[BR]]
     40'''FastCGI'''[[BR]]
     41FastCGI is a protocol for interfacing interactive programs with a web server. This is a variation on the earlier Common Gateway Interface (CGI). Unlike CGI, It cannot [[BR]]
     42duplicates the universality of CGI overnight. It runs applications in processes isolated from the core Web server, which provides greater security than APIs. Not only does
     43FastCGI restore the strengths of CGI, it also adds two new benefits like Distributed computing and Multiple extensible roles.[[BR]]
     44Download the source[http://www.fastcgi.com/]
     45Installation & Configuration
     46{{{
     47tar -xzf fcgi-2.4.0.tar.gz
     48cd fcgi-2.4.0/
     49./configure —prefix=/usr/local/
     50make
     51make install
     52}}}
     53You have installed the FastCGI executables and libraries now, we will use this later while configuring the Map Server.
     54'''Proj.4'''
     55It is Cartographic Projections library is designed as a standard Unix filter utility to be employed with other pro-grams in the generation of maps and charts and, in many [[BR]]cases, used in map digitizing applications for conversion of State Plane Coordinate Systems to and from geographic coordinates.
     56Download the source[http://trac.osgeo.org/proj/]
     57Installation & Configuration
     58{{{
     59tar -xzf proj-4.7.0.tar.gz
     60cd proj-4.7.0/
     61./configure —prefix=/usr/local/
     62make
     63make install
     64}}}
     65You have successfully compiled the Proj4 libraries required for Map Server.
     66'''LighHTTPD'''
     67Lighttpd is a web server designed and optimized for high performance environments, with a small memory footprint compared to other web-servers and effective management of the[[BR]] cpu-load. This is a perfect solution for every server which is suffering load problems.
     68Download the source[http://www.lighttpd.net/]
     69Installation & Configuration
     70{{{
     71tar -xzf lighttpd-1.4.26.tar.gz
     72cd lighttpd-1.4.26/
     73p<>. ./configure —prefix /usr/local/ —bindir=/usr/local/bin/ —sbindir=/usr/local/sbin/ —libexecdir=/usr/local/libexec/ —libdir=/usr/local/lib/ —includedir=/usr/local/include —sysconfdir=/usr/local/lighthttpd —datarootdir=/var/www/ —datadir=/var/www —with-memcache
     74make
     75make install
     76install -Dp ./doc/lighttpd.conf /etc/lighttpd/lighttpd.conf
     77sed -e ‘s/FOO/lighttpd/g’ doc/rc.lighttpd.redhat > /etc/init.d/lighttpd
     78chmod a+rx /etc/init.d/lighttpd
     79/etc/init.d/lighttpd start
     80}}}
     81You have successfully compiled and configured your fast & secure Lighttpd web server.
     82'''FreeType'''
     83FreeType is a software font engine that is designed to be small, efficient, highly customizable, and portable while capable of producing high-quality output. It can be used [[BR]]in graphics libraries, display servers, font conversion tools, text image generation tools, and many other products as well.
     84Download the source[http://www.freetype.org/]
     85Installation & Configuration
     86{{{
     87tar -xzf freetype-2.3.12.tar.gz
     88cd freetype-2.3.12/
     89./configure —prefix=/usr/local/
     90make
     91make install
     92}}}
     93You have successfully compiled the FreeType libraries required for Map Server.
     94'''GEOS'''
     95Geos GEOS is a Geometry Engine which aims to contain the complete functionality of Java Topology Suite. This includes all the GIS Simple Features for SQL spatial predicate [[BR]]functions and spatial operators, as well as specific JTS enhanced topology functions.
     96Download the source [http://trac.osgeo.org/geos/]
     97Installation & Configuration
     98{{{
     99tar -xjf geos-3.2.0.tar.bz2
     100cd geos-3.2.0/
     101./configure —prefix=/usr/local/ —enable-python —enable-swig
     102make
     103make install
     104}}}
     105You have successfully compiled the Geos libraries required for Map Server.
     106'''GD'''
     107GD is used for dynamic creation of images like PNG, JPEG and GIF images, among other formats. GD is commonly used to generate charts, graphics, thumbnails, and most anything[[BR]] else, on the fly.
     108Download the source [http://www.libgd.org/]
     109Installation & Configuration
     110{{{
     111tar -xzf gd-2.0.35.tar.gz
     112cd gd-2.0.35/
     113./configure —prefix=/usr/local/ —with-png=/usr/ —with-jpeg=/usr/local/ —with-fontconfig=/usr/
     114make
     115make install
     116}}}
     117You have successfully compiled the GD binaries and it’s libraries required for Map Server.
     118'''PHP'''
     119PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. Here we are configuring PHP with [[BR]]
     120PostgreSql and GD with is required for PHP mapscript, and compiling as fast-cgi to get the maximum security and speed.
     121Download the source [http://php.net/]
     122Installation & Configuration
     123{{{
     124tar -xzf php-5.3.2.tar.gz
     125cd php-5.3.2/
     126./configure —prefix=/usr/local/php5 —with-fastcgi=/usr/local —with-regex=php —enable-debug —enable-magic-quotes —enable-libgcc —with-libxml-dir=/usr/local/ —with-openssl=/usr[[BR]] —with-kerberos=/usr/local/ —with-zlib=/usr —with-bz2=/usr/local/ —with-curl=/usr/local/ —with-gettext=/usr/local/ —enable-mbstring —with-pgsql=/usr/local/pgsql/ —enable-soap —enable-zip —with-gd=/usr/local/ —with-jpeg-dir=/usr/local/ —with-png-dir=/usr/local/ —with-mhash=/usr/local/
     127make
     128make install
     129cp -pr php.ini-production /usr/local/php5/lib/php.ini
     130}}}
     131You have successfully compiled PHP as fast-cgi in the server.
     132'''PostGIS'''
     133PostGIS PostGIS adds support for geographic objects to the PostgreSQL object-relational database. In effect, PostGIS “spatially enables” the PostgreSQL server, allowing it to[[BR]] be used as a backend spatial database for geographic information systems (GIS).
     134Download the source[ http://postgis.refractions.net/]
     135Installation & Configuration
     136{{{
     137tar -xzf softwares/postgis-1.5.1.tar.gz
     138cd postgis-1.5.1/
     139./configure —prefix=/usr/local/ —with-geosconfig=/usr/local/bin/geos-config —with-pgsql=/usr/local/pgsql/bin/pg_config
     140make
     141make install
     142}}}
     143You have successfully configured postGIS with PostgreSQL and Geos, compiled the source and installed the binaries. Now you create a PostgreSQL database and spatially enables [[BR]]it by importing the PostGIS sql functions.
     144{{{
     145createdb -U postgres testgis
     146createlang -U postgres plpgsql testgis
     147psql -U postgres testgis < postgis/postgis.sql
     148psql -U postgres testgis < spatial_ref_sys.sql
     149}}}
     150'''GDAL'''
     151GDAL (Geospatial Data Abstraction Library) is a library for reading and writing raster geospatial data formats. As a library, it presents a single abstract data model to the[[BR]] calling application for all supported formats. It may also be built with a variety of useful command-line utilities for data translation and processing.
     152Download the source http://www.gdal.org/
     153Installation & Configuration
     154{{{
     155tar -xzf gdal-1.7.1.tar.gz
     156cd gdal-1.7.1/
     157./configure —prefix=/usr/local/ —with-png=/usr/ —with-libtiff=/usr/local/ —with-jpeg=/usr/local/ —with-gif=/usr/ —with-pg=/usr/local/pgsql/bin/pg_config —with-geos=/usr/local/ —with-python
     158make
     159make install
     160}}}
     161You have successfully compiled Gdal with png,tiff,jpeg,gif,PostgreSQL and python. Now your Gdal library is available to build the Map Server.
     162Map Server
     163'''Map Server'''
     164MapServer is geographic data rendering engine, providing spatial context where needed. It allows you to create geographic image maps that can direct users to content. It was[[BR]] originally developed by the University of Minnesota (UMN) ForNet project in cooperation with NASA. The main features are,
     165    * Advanced cartographic output
     166    * Scale dependent feature drawing and application execution
     167    * Feature labeling including label collision mediation
     168    * Fully customizable, template driven output
     169    * TrueType fonts
     170    * Map element automation (scalebar, reference map, and legend)
     171    * Thematic mapping using logical- or regular expression-based classes
     172    * Support for popular scripting and development environments, ie PHP, Python, Perl, Ruby, Java.
     173    * Cross-platform support
     174    * Support of numerous Open Geospatial Consortium (OGC) standards, ie WMS,WFS, WMC, WCS, Filter Encoding, SLD, GML, SOS, OM
     175    * A multitude of raster and vector data formats, ie TIFF/GeoTIFF, EPPL7, ESRI shapfiles, PostGIS, ESRI ArcSDE, Oracle Spatial, MySQL
     176    * On-the-fly map projection with 1000s of projections through the Proj.4 library.
     177Download the source [http://mapserver.org/]
     178Installation & Configuration
     179{{{
     180tar -xzf mapserver-5.6.1.tar.gz
     181cd mapserver-5.6.1/
     182./configure —prefix=/usr/local/ —with-gdal=/usr/local/bin/gdal-config —with-ogr=/usr/local/bin/gdal-config —with-httpd=/usr/local/sbin/lighttpd —with-curl=/usr/bin/curl-config[[BR]] —enable-debug —with-proj=/usr/local/ —with-tiff=/usr/ —with-gd=/usr/local/ —with-jpeg=/usr/local/ —with-freetype=/usr/local/ —with-threads [[BR]]—with-postgis=/usr/local/pgsql/bin/pg_config —with-xml2-config=/usr/bin/xml2-config —with-png=/usr/ —with-wmsclient —with-wmsserver —with-fastcgi=/usr/local/ —with-wfs [[BR]]with-wfsclient —with-gif=/usr/ —with-geos=/usr/local/bin/geos-config —with-php=/usr/local/php5
     183make
     184make install
     185cp -pr mapserv /var/www/cgi-bin/
     186}}}
     187You have successfully compiled the Map Server with all it’s prerequisites and bindings,and as fast-cgi binary. Now you can test your installation by running “mapserv” binary.[[BR]] If you get below output, it seems your installation is successful.
     188{{{
     189./mapserv -v
     190MapServer version 5.6.1 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=WMS_SERVER [[BR]]SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS INPUT=TIFF INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE
     191}}}
     192PHP & Map server FastCGI configuration with Lighttpd. Edit Lighttpd.conf,
     193{{{
     194vi /etc/lighttpd/lighttpd.conf
     195}}}
     196and insert below configuration under the fastcgi section.
     197{{{
     198fastcgi.server = ( “.php” =>
     199( “localhost” =>
     200(
     201“socket” => “/tmp/php-fastcgi.socket”,
     202“bin-path” => “/usr/local/php5/bin/php-cgi”
     203)
     204),
     205“/map” =>
     206( “localhost” =>
     207(
     208“socket” => “/tmp/mapserver-fastcgi.socket”,
     209“bin-path” => “/var/www/cgi-bin/mapserv”,
     210“max-procs” => 1,
     211“check-local” => “disable”
     212)
     213)
     214)
     215}}}
     216Restart your Lighttpd server.
     217{{{
     218/etc/init.d/lighttpd restart
     219}}}
     220Your Light Speed FastCGI Map Server Web Map Service(WMS) is up and running now. :) Try it from the URL http://localhost/maps?map=yourmapfile.map
     221Contact me for any further help.
     222
     223Nishad Aliyar
     224nishad.n.a@gmail.com