This short note explain how to configure, build and install the latest mapserver release on SuSE Linux.
Mapserver use many external libraries to handle projections, and several raster and vector formats. In order to enable PHP/Mapscript, the definitive tool for WebGIS scripting, you will need also the PHP include headers and of course a working PHP installation.
If you plan to use a RDBMS such as POSTGIS or MySQL (the lattest is not a spatial enabled datasource, but can still be useful), you will need also those packages.
The problem here is that in most cases, if you install those required libraries from precompiled binary packages, they will miss some important configuration files or source include headers that mapserver needs to parse during compilation. For this reason we will compile most of the required libraries from sources.
Some other common libraries (e.g. zlib gd or libjpeg) are required and can be installed throug RPMs directly from the SuSE installation media or from the net, don’t forget to install also the corresponding "devel" packages (the package that contains the source code).
During the configuration step of one or more of the following libraries, you will probably see some errors regarding missing libraries, if this happens, don’t panic, you will surely find those libraries in the SuSE repositories.
Please follow the compilation steps in this order, otherwise you will break dependencies. I will assume you will operate as a normal unprivileged user, only the installation step must be done as root.
GEOS (Geometry Engine – Open Source) is C++ port of Java Topology Suite (JTS), download it from geos.refractions.net, choose the latest version (at the time of writing is http://geos.refractions.net/geos-2.2.1.tar.bz2) and save the compressed tar archive somewhere on your disk .
$ wget http://geos.refractions.net/geos-2.2.1.tar.bz2
Then uncompress it (a new directory will be created):
$ tar -xjvf geos-2.2.1.tar.bz2
change to the new directory:
$ cd geos-2.2.1
Now start the configuration script, we will install all our libraries in /usr/local (the default is /usr, but it is always a better approach to keep manually installed software in a separated location)
$ ./configure --prefix=/usr/local
If you get some configuration errors, read carefully the error message and install the missing pieces with yast. Then proceed with the usual compilation command:
$ make $ su -c "make install"
GDAL is a translator library for raster geospatial data formats, download the latest release from www.remotesensing.org/gdal/.
$ wget http://www.gdal.org/dl/gdal-1.3.1.tar.gz
Proceed now as you did for geos:
$ tar -xzvf gdal-1.3.1.tar.gz $ cd gdal-1.3.1/ $ ./configure --prefix=/usr/local $ make $ su -c "make install"
Installing proj4Proj4 is a Cartographic Projections Library, get it fom proj.maptools.org
$ wget ftp://ftp.remotesensing.org/proj/proj-4.4.9.tar.gz
Proceed as usual:
$ tar -xzvf proj-4.4.9.tar.gz $ cd proj-4.4.9 $ ./configure --prefix=/usr/local $ make $ su -c "make install"Note: if the configure script fails complaining about missing proj4 header files, try copying
/usr/local/lib, this makes absolutely no sense to me but it works.
Install mapserver webgis
Mapserver (even if someone is now calling it "Mapserver Cheetah", I’m speaking of the old good "original" mapserver) is an Open Source development environment for building spatially-enabled internet applications.
The new site is now online at mapserver.gis.umn.edu take a look at it if you need some other informations about this powerful technology.
Now download the source code:
$ wget http://cvs.gis.umn.edu/dist/mapserver-4.6.2.tar.gz $ tar -xzvf mapserver-4.6.2.tar.gz $ cd mapserver-4.6.2
We are close to the point: we will enable many mapserver features, in particular, POSTGIS, MySQL and PHP/Mapscript support, if you don’t need those features, just delete the corresponding lines. Change also the PHP and Apache executable paths according to your installation, in my case I’m working with PHP5 and Apache is in
$ ./configure \ --with-wfs \ --with-wfsclient \ --with-wmsclient \ --with-proj=/usr/local/lib \ --with-gdal=/usr/local/bin/gdal-config \ --with-ogr=/usr/local/bin/gdal-config \ --with-php=/usr/include/php5 \ --with-mygis=yes \ --with-postgis \ --with-httpd=/usr/sbin/httpd2 \ --prefix=/usr/local
Now check configure output and proceed to compilation
There is no
make install in mapserver, just copy
mapserv executable in your CGI directory (usually
If you have enabled PHP/Mapscript, copy the shared object
/mapscript/php3/php_mapscript.so to yor PHP extension directory (usually
Finally, restart apache webserver and enjoy your fresh mapserver build!