Verbose Linux Installation
Revision History
- Version 0.1.0 (April 27, 2005: anthony3) — First version of this document.
- Version 0.1.1 (August 6, 2005: anthony3) — Updated packages and installs where needed.
- Version 0.2.0 (Septemer 13, 2005: anthony3) — Added MapServer installation and configuration section.
- Version 0.3.0 (September 22, 2005: anthony3) — Reformatted the document for the MapServer Plone site.
- Version 0.4.0 (January 18, 2006: anthony3) — Removed unnecessary sections of the document.
- Version 0.4.1 (January 19, 2006: anthony3) — Modified License and Disclaimer sections.
- Version 0.4.2 (January 24, 2006: anthony3) — Updated packages and installs where needed.
This document describes the installation of MapServer on a Linux distribution with installation and configuration instructions for all related software. It assumes only a rudimentary understanding of Linux.
- Introduction
- Installing Apache
- Installing PostgreSQL
- Installing PHP
- Installing PostGIS
- Installing MapServer
Introduction
About this Document
The installation of MapServer on a Linux distribution is not the most well documented software around, with only hints of "install this, then install that" to be found on the Internet. To simplify and hopefully demystify this process, this document takes a step by step installation approach of every piece of software needed to get MapServer up and running on your Linux distribution.
This document assumes that a Linux Distribution (Fedora Core 4 in all examples) with development tools installed is already up and running. Furthermore, that this distribution does not have Apache, PHP or PostgreSQL installed. If any of these components have been installed, please uninstall them before continuing with this documentation.
This document is based on my own experience and compiled to benefit the community.
Necessary Software Packages
Required Software
- Apache
- Apache is the web server we will be using. At the time of this writing, Apache 2.2.0 is the current stable release.
- PHP
- PHP is required in order to use PHP/MapScript. PHP 4.3.11 is the current stable release that works with Apache 2.x, however, with certain compile options with Apache (threading), PHP 5.1.2 is also stable and will be the package used in this document.
- MapServer
- MapServer is what this document is all about! MapServer 4.8.0-RC2 is the current release.
- libpng
- libpng should already be on your system by default. 1.2.8-2 is the current stable release.
- freetype
- GD requires freetype version 2.x or above. The current stable release is 2.1.9-2.
- GD
- libgd is used to actually render images by MapServer. Version 2.0.28 or greater is required, as earlier versions of GD did not support the GIF file format thanks to the UNISYS patent on GIFs. This may already be on your system, but check the version. The current stable version is 2.0.33-2.
- Zlib
- Zlib should already be on your system by default. 1.2.3 is the current stable release.
Highly Recommended Software
- PostgreSQL
- PostgreSQL is an object-relational database that can be used to store data utilizing PostGIS. The current stable release is 8.1.2.
- PostGIS
- PostGIS "spatially enables" the PostgreSQL server, allowing it to be used as a backend spatial database for geographic information systems (GIS), much like ESRI's SDE or Oracle's Spatial extension. 1.1.0 is the current stable release.
- Proj4
- The Proj4 library is used to provide coordinate reprojection support within PostGIS and MapServer. 4.4.9 is the current stable release.
- GEOS
- The GEOS library is used to provide geometry tests within PostGIS. 2.2.1 is the current stable release.
- GDAL
- GDAL provides access to at least 42 different raster formats, while OGR provides access to at least 18 different vector formats. 1.3.1 is the current stable release and contains both GDAL and OGR libraries.
Document License
This document, the Verbose Linux Installation: MapServer (and all related software) Installation and Configuration, is distributed under the same Free Software license as the MapServer software. See the MapServer's License and Credits page for the complete text.
Copyright © 2005 - 2006. Anthony T. Holdener, III.
Disclaimer
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MapServer License for more details.
All copyrights are held by their by their respective owners, unless specifically noted otherwise. Use of a term in this document should not be regarded as affecting the validity of any trademark or service mark. Naming of particular products or brands should not be seen as endorsements.
Installing Apache
Download the latest source code from Apache's website
(http://httpd.apache.org/) and place the file
in /usr/local/. In this document, the source is httpd-2.2.0.tar.gz.
Unpacking the Source
[anthony3@aragog ~]$ cd /usr/local/ [anthony3@aragog local]$ tar -xvzf httpd-2.2.0.tar.gz httpd-2.2.0/ httpd-2.2.0/os/ httpd-2.2.0/os/os2/ . . . httpd-2.2.0/include/util_cfgtree.h [anthony3@aragog local]$
Configuring Apache
[anthony3@aragog local]$ cd httpd-2.2.0/ [anthony3@aragog httpd-2.2.0]$ ./configure \ > --prefix=/usr/local/apache2 \ > --enable-deflate \ > --enable-info \ > --enable-mime-magic \ > --enable-rewrite \ > --enable-so \ > --enable-speling \ > --enable-ssl \ > --enable-unique_id \ > --enable-usertrack \ > --with-mpm=prefork checking for chosen layout... Apache checking for working mkdir -p... yes checking build system type... i686-pc-linux-gnu . . . config.status: executing default commands [anthony3@aragog httpd-2.2.0]$The
--enable-soconfiguration and--with-mpm=preforkconfiguration are the only configurations you truly need when configuring apache. The rest of the configure options are just nice to have. For more information on these and other options, type ./configure --help or see "Compiling and Installing" in the Apache 2 Documentation, http://httpd.apache.org/.
Compiling Apache
When compiling and installing Apache, make sure that you are root, or have superuser privileges. For all examples in this documentation, user
anthony3has superuser privileges.[anthony3@aragog httpd-2.2.0]$ make Making all in srclib make[1]: Entering directory '/usr/local/httpd-2.2.0/srclib' Making all in apr . . . make[1]: Leaving directory '/usr/local/httpd-2.2.0' [anthony3@aragog httpd-2.2.0]$ make install Making install in srclib make[1]: Entering directory '/usr/local/httpd-2.2.0/srclib' Making install in apr . . . make[1]: Leaving directory '/usr/local/httpd-2.2.0' [anthony3@aragog httpd-2.2.0]$
Starting and Testing Apache
Having completed the above steps, the server now needs to be started, and the server can be tested.
[anthony3@aragog httpd-2.2.0]$ /usr/local/apache2/bin/apachectl start [anthony3@aragog httpd-2.2.0]$Open up a web browser, and test the server by going to http://localhost/. You should see the "Test Page for Apache Installaion" web page.
Configuring Automatic Startup of Apache
[anthony3@aragog httpd-2.2.0]$ cp /usr/local/apache2/bin/apachectl /etc/init.d/. [anthony3@aragog httpd-2.2.0]$Edit
/etc/init.d/apachectlby inserting the lines that are in bold:#!/bin/sh # # chkconfig: - 85 15 # description: Apache is a Web server used to serve HTML and CGI. # processname: httpd # pidfile: /usr/local/apache2/logs/httpd.pid # # Copyright 2000 - 2005 The Apache Software Foundation or its licensors, as # applicable. . . .[anthony3@aragog httpd-2.2.0]$ /sbin/chkconfig --add apachectl [anthony3@aragog httpd-2.2.0]$
Installing PostgreSQL
Download the latest source code from PostgreSQL's website
(http://www.postgresql.org/)
and place the file in /usr/local/. In this document, the
source is postgresql-8.1.2.tar.gz.
Unpacking the Source
[anthony3@aragog httpd-2.2.0]$ cd /usr/local/ [anthony3@aragog local]$ tar -xvzf postgresql-8.1.2.tar.gz postgresql-8.1.2/ postgresql-8.1.2/doc/ postgresql-8.1.2/doc/src/ . . . postgresql-8.1.2/INSTALL [anthony3@aragog local]$
Configuring PostgreSQL
[anthony3@aragog local]$ cd postgresql-8.1.2/ [anthony3@aragog postgresql-8.1.2]$ LDFLAGS=-lstdc++ ./configure \ > --prefix=/usr/local/pgsql \ > --with-perl \ > --with-python \ > --with-krb5 \ > --with-openssl checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking which template to use... linux . . . config.status: linking ./src/makefiles/Makefile.linux to src/Makefile.port [anthony3@aragog postgresql-8.1.2]$The
--prefixconfiguration is the only one you actually need. For more information on these and other options, type ./configure --help or see "Installation Procedure" in the PostgreSQL Documentation, http://www.postgresql.org/docs/8.1/static/.
Compiling PostgreSQL
When compiling and installing PostgreSQL, make sure that you are root, or have superuser privileges. For all examples in this documentation, user
anthony3has superuser privileges.[anthony3@aragog postgresql-8.1.2]$ make make -C doc all make[1]: Entering directory '/usr/local/postgresql-8.1.2/doc' gzip -d -c man.tar.gz | /bin/tar xf - . . . All of PostgreSQL successfully made. Ready to install. [anthony3@aragog postgresql-8.1.2]$ make install make -C doc install make[1]: Entering directory '/usr/local/postgresql-8.1.2/doc' mkdir -p -- /usr/local/pgsql/doc/html . . . PostgreSQL installation complete. [anthony3@aragog postgresql-8.1.2]$
Post Compile PostgreSQL Configuration
Once the above steps have been completed, the database needs to be configured with a default user.
[anthony3@aragog postgresql-8.1.2]$ /usr/sbin/adduser postgres [anthony3@aragog postgresql-8.1.2]$ mkdir /usr/local/pgsql/data [anthony3@aragog postgresql-8.1.2]$ chown postgres /usr/local/pgsql/data/ [anthony3@aragog postgresql-8.1.2]$ su - postgres [postgres@aragog postgresql-8.1.2]$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data/ This files belonging to this database system will be owned by user "postgres". This user must also own the server process. . . . or /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start [postgres@aragog postgresql-8.1.2]$
Starting and Testing PostgreSQL
[postgres@aragog postgresql-8.1.2]$ /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data/ -l /usr/local/pgsql/data/logfile start postmaster starting [postgres@aragog postgresql-8.1.2]$ /usr/local/pgsql/bin/createdb test CREATE DATABASE [postgres@aragog postgresql-8.1.2]$ /usr/local/pgsql/bin/psql test Welcome to psql 8.1.2, the PostgreSQL interactive terminal. Type: \copyright for distribution terms . . . test=# \q [postgres@aragog postgresql-8.1.2]$ exit [anthony3@aragog postgresql-8.1.2]$
Configuring Automatic Startup of PostgreSQL
As root, create
/etc/init.d/postgresql.[anthony3@aragog postgresql-8.1.2]$ touch /etc/init.d/postgresql [anthony3@aragog postgresql-8.1.2]$Then add to the file:
#!/bin/sh # postgresql This is the init script for starting up the PostgreSQL # server # chkconfig: - 85 15 # description: Starts and stops the PostgreSQL backend daemon that handles all database requests. # processname: postmaster # pidfile: /usr/local/pgsql/data/postmaster.pid # # Source function library. . /etc/rc.d/init.d/functions # Get config. . /etc/sysconfig/network # Check that networking is up. # Pretty much need it for postmaster. [ ${NETWORKING} = "no" ] && exit 0 [ -f /usr/local/pgsql/bin/postmaster ] || exit 0 # See how we were called. case "$1" in start) pid=`pidof postmaster` if [ $pid ] then echo "Postmaster already running." else echo -n "Starting postgresql service: " su -l postgres -c '/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data/ -l /usr/local/pgsql/data/logfile start' sleep 1 echo exit fi ;; stop) echo -n "Stopping postgresql service: " killproc postmaster sleep 2 rm -f /usr/local/pgsql/data/postmaster.pid echo ;; restart) $0 stop $0 start ;; *) echo "Usage: postgresql {start|stop|restart}" exit 1 esac exit 0[anthony3@aragog postgresql-8.1.2]$ chmod 700 /etc/init.d/postgresql [anthony3@aragog postgresql-8.1.2]$ /sbin/chkconfig --add postgresql [anthony3@aragog postgresql-8.1.2]$
Installing PHP
Download the latest source code from PHP's website
(http://www.php.net/) and place the file
in /usr/local/. In this document, the source is
php-5.1.2.tar.gz.
Unpacking the Source
[anthony3@aragog postgresql-8.1.2]$ cd /usr/local/ [anthony3@aragog local]$ tar -xvzf php-5.1.2.tar.gz php-5.1.2/ php-5.1.2/ext/ php-5.1.2/ext/db/ . . . php-5.1.2/buildconf.bat [anthony3@aragog local]$
Configuring PHP
[anthony3@aragog local]$ cd php-5.1.2/ [anthony3@aragog php-5.1.2]$ ./configure \ > --prefix=/usr/local/apache2/php \ > --with-apxs2=/usr/local/apache2/bin/apxs \ > --disable-cgi \ > --with-config-file-path=/usr/local/apache2/php \ > --with-openssl \ > --with-kerberos \ > --with-zlib \ > --with-bz2 \ > --with-curl \ > --enable-dbase \ > --with-gd \ > --with-pgsql \ > --with-xsl \ > --with-mysql \ > --with-gettext > --with-regex=system creating cache ./config.cache checking for Cygwin environment... no checking for mingw32 environment... no . . . Thank you for using PHP. [anthony3@aragog php-5.1.2]$The
--with-apxs2,--with-pgsql,--enable-dbaseand--with-config-fileconfigurations are the only ones you need for MapServer. Obviously do not use the--with-mysqlconfiguration if you do not have a MySQL database installed. For more information on these and other options, type ./configure --help or see "Installation" in the PHP Manual, http://www.php.net/docs.php.Configure Notes for PHP
When you configure PHP, if you get the following error, or any similar error:
If configure fails try --with-jpeg-dir=<DIR> configure: error: libpng.(a|so) not found.The solution to this and similar errors is to locate and install the matching -devel package. In the case of the example,
libpng-devel-1.2.8-2.i386.rpmis what needs to be installed on the machine.
Compiling PHP
When compiling and installing PHP, make sure that you are root, or have superuser privileges. For all examples in this documentation, user
anthony3has superuser privileges.[anthony3@aragog php-5.1.2]$ make /bin/sh /usr/local/php-5.1.2/libtool --silent --preserve-dup-deps --mode=compile gcc -Iext/libxml/ -I/usr/local/php-5.1.2/ext/libxml/ -DPHP_ATOM_INC -I/usr/local/php-5.1.2/include -I/usr/local/php-5.1.2/main -I/usr/local/php-5.1.2 -I/usr/include/libxml2 -I/usr/kerberos/include -I/usr/local/ php-5.1.2/ext/date/lib -I/usr/include/mysql -I/usr/local/pgsql/include -I/usr/local/php-5.1.2/TSRM -I/usr/local/php-5.1.2/Zend -I/usr/include -g -O2 . . . (It is safe to ignore warnings about tempnam and tmpnam). [anthony3@aragog php-5.1.2]$ make install Installing PHP SAPI module: apache2handler /usr/local/apache2/build/instdso.sh SH_LIBTOOL='/usr/local/apache2/build/libtool' libphp5.la /usr/local/apache2/modules /usr/local/apache2/build/libtools --mode=install cp libphp5.la /usr/local/apache2/modules/ . . . Installing PDO headers: /usr/local/apache2/php/include/php/ext/pdo/ [anthony3@aragog php-5.1.2]$
Post Compile PHP Configuration
[anthony3@aragog php-5.1.2]$ cp php.ini-recommended /usr/local/apache2/php/php.ini [anthony3@aragog php-5.1.2]$Add the following directives to
/usr/local/apache2/conf/httpd.confand if they are already there, verify that they are correct:Around line 53: LoadModule php5_module modules/libphp5.so Around line 165: <IfModule dir_module> DirectoryIndex index.php index.html </IfModule> Around line 307: AddType application/x-httpd-php .php .phtml AddType application/x-httpd-php-source .phpsRestart the Apache server.
[anthony3@aragog php-5.1.2]$ /usr/local/apache2/bin/apachectl restart [anthony3@aragog php-5.1.2]$
Testing PHP
Create a file called
/usr/local/apache2/htdocs/index.php.[anthony3@aragog php-5.1.2]$ touch /usr/local/apache2/htdocs/index.php [anthony3@aragog php-5.1.2]$Then add to the file:
<?php echo phpinfo(); ?>Open up a web browser, and test the server by going to
http://localhost/. You should see the "phpinfo() " output.PHP Logo PHP Version 5.1.2 System Linux aragog 2.6.14-1.1656_FC4smp #1 SMP Thu Jan 5 22:24:06 EST 2006 i686 Build Date Jan 23 2006 21:27:57 Configure Command './configure' '--prefix=/usr/local/apache2/php' '--with-apxs2=/usr/local/apache2/bin/apxs' '--disable-cgi' '--with-config-file-path=/usr/local/apache2/php' '--with-openssl' '--with-kerberos' '--with-zlib' '--with-bz2' . . . If you did not receive a copy of the PHP license, or have any questions about PHP licensing, please contact license@php.net.
Installing PostGIS
Download the latest source code from PostGIS's website
(http://www.postgis.org/) and place
the file in /usr/local/. In this document, the source is
postgis-1.1.0.tar.gz.
PostGIS and MapServer can use the Proj4 reprojection library. The Proj4
library is used to provide coordinate reprojection support within PostGIS.
Download the latest source code from
http://www.remotesensing.org/proj/
and place the file in /usr/local/. In this document, the
source is proj4-4.4.9.tar.gz.
PostGIS can alse use the GEOS geometry library. The GEOS library is used
to provide geometry tests (Touches(), Contains(), Intersects()) and
operations (Buffer(), GeomUnion, Difference()) within PostGIS. Download
the latest source code from
http://geos.refractions.net/
and place the file in /usr/local/. In this document, the
source is geos-2.2.1.tar.bz2.
Unpacking and Installing Recommended PostGIS Packages
When compiling and installing Proj4 and GEOS, make sure that you are root, or have superuser privileges. For all examples in this documentation, user
anthony3has superuser privileges.[anthony3@aragog php-5.1.2]$ cd /usr/local/ [anthony3@aragog local]$ tar -xvzf proj-4.4.9.tar.gz proj-4.4.9/ proj-4.4.9/README proj-4.4.9/configure.in . . . proj-4.4.9/jniwrap/org/proj4/Projections.java [anthony3@aragog local]$ cd proj-4.4.9/ [anthony3@aragog proj-4.4.9]$ ./configure checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for gawk... gawk . . . config.status: executing depfiles commands [anthony3@aragog proj-4.4.9]$ make making all in src make[1]: Entering directory '/usr/local/proj-4.4.9/src' make all-am . . . make[1]: Leaving directory '/usr/local/proj-4.4.9/' [anthony3@aragog proj-4.4.9]$ make install Making install for src make[1]: Entering directory '/usr/local/proj-4.4.9/src' make[2]: Entering directory '/usr/local/proj-4.4.9/src' . . . make[1]: Leaving directory '/usr/local/proj-4.4.9/' [anthony3@aragog proj-4.4.9]$ cd .. [anthony3@aragog local]$ bunzip2 geos-2.2.1.tar.bz2 [anthony3@aragog local]$ tar -xvf geos-2.2.1.tar geos-2.2.1/ geos-2.2.1/doc/ geos-2.2.1/doc/README . . . geos-2.1.4/VisualStudio/GEOS.vcproj [anthony3@aragog local]$ cd geos-2.2.1/ [anthony3@aragog geos-2.2.1]$ ./configure checking build system type... i686-redhat-linux-gnu checking host system type... i686-redhat-linux-gnu checking target system type... i686-redhat-linux-gnu . . . config.status: executing depfiles commands [anthony3@aragog geos-2.2.1]$ make Making all in source make[1]: Entering directory '/usr/local/geos-2.2.1/source' Making all in geom . . . make[1]: Leaving directory '/usr/local/geos-2.2.1' [anthony3@aragog geos-2.2.1]$ make install Making install in source make[1]: Entering directory '/usr/local/geos-2.2.1/source' Making install in geom . . . make[1]: Leaving directory '/usr/local/geos-2.2.1' [anthony3@aragog geos-2.2.1]$
Unpacking the Source
[anthony3@aragog geos-2.2.1]$ cd /usr/local [anthony3@aragog local]$ tar -xvzf postis-1.1.0.tar.gz postis-1.1.0/ postis-1.1.0/doc/ postis-1.1.0/doc/html/ . . . postis-1.1.0/utils/test_joinestimation.pl [anthony3@aragog local]$ mv postgis-1.1.0 postgresql-8.1.2/contrib/ [anthony3@aragog local]$
Configuring PostGIS
[anthony3@aragog local]$ cd postgresql-8.1.2/contrib/postgis-1.1.0 [anthony3@aragog postgis-1.1.0]$ ./configure \ > --with-pgsql=/usr/local/pgsql/bin/pg_config checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes . . . ---------------------------------------------------- [anthony3@aragog postgis-1.1.0]$
Compiling PostGIS
When compiling and installing PostGIS, make sure that you are root, or have superuser privileges. For all examples in this documentation, user
anthony3has superuser privileges.[anthony3@aragog postgis-1.1.0]$ make make -C lwgeom make[1]: Entering directory '/usr/local/postgresql-8.1.2/contrib/postgis-1.1.0/lwgeom' cpp -P -traditional-cpp -DUSE_VERSION=81 lwpostgis.sql.in | sed -e 's:@MODULE_FILENAME@:\$libdir/liblwgeom.so.1.1:g;s:@POSTGIS_VERSION@:1.1 USE_GEOS=1 USE_PROJ=1 . . . make[1]: Leaving directory '/usr/local/postgresql-8.1.2/contrib/postgis-1.1.0/utils' [anthony3@aragog postgis-1.1.0]$ make install make -C lwgeom make[1]: Entering directory '/usr/local/postgresql-8.1.2/contrib/postgis-1.1.0/lwgeom' make[1]: Nothing to be done for `all'. . . . make[1]: Leaving directory '/usr/local/postgresql-8.1.2/contrib/postgis-1.1.0/loader' [anthony3@aragog postgis-1.1.0]$Compile Notes for PostGIS
Once PostGIS, Proj4 and GEOS have been compiled, their libraries must be registered with operating system. As root, edit the file
/etc/ld.so.conf, adding the following line:/usr/local/lib/Then reload:
[anthony3@aragog postgis-1.1.0]$ ldconfig [anthony3@aragog postgis-1.1.0]$
Post Compile PostGIS Configuration
Once the above steps have been completed, the PostgreSQL database needs to have PostGIS added. In this example, the "test" database will be used.
[anthony3@aragog postgis-1.1.0]$ su - postgres [postgres@aragog postgis-1.1.0]$ /usr/local/pgsql/bin/createlang plpgsql test [postgres@aragog postgis-1.1.0]$ /usr/local/pgsql/bin/psql -d test -f /usr/local/pgsql/share/postgresql/contrib/lwpostgis.sql BEGIN psql:/usr/local/pgsql/share/postgresql/contrib/lwpostgis.sql:39 NOTICE: type "histogram2d" is not yet defined DETAIL: Creating a shell type definition. . . . COMMIT [postgres@aragog postgis-1.1.0]$ /usr/local/pgsql/bin/psql -d test -f /usr/local/pgsql/share/postgresql/contrib/spatial_ref_sys.sql BEGIN INSERT 0 1 INSERT 0 1 . . . VACUUM [postgres@aragog postgis-1.1.0]$ exit [anthony3@aragog postgis-1.1.0]$
Installing MapServer
Download the latest source code from MapServer's website
(http://ms.gis.umn.edu/) and place
the file in /usr/local/. In this document, the source is
mapserver-4.8.0-rc2.tar.gz.
MapServer can and should use the GDAL/OGR library. GDAL provides access
to at least 42 different raster formats, while OGR provides access to at
least 18 different vector formats. Download the latest source code from
http://www.gdal.org/ and place the
file in /usr/local/. In this document, the source is
gdal-1.3.1.tar.gz.
Unpacking and Installing the GDAL/OGR library
When compiling and installing GDAL/OGR, make sure that you are root, or have superuser privileges. For all examples in this documentation, user
anthony3has superuser privileges.[anthony3@aragog postgis-1.1.0]$ cd /usr/local/ [anthony3@aragog local]$ tar -xvzf gdal-1.3.1.tar.gz gdal-1.3.1/ gdal-1.3.1/alg/ gdal-1.3.1/alg/.cvsignore . . . gdal-1.3.1/vb6/vb6_support.cpp [anthony3@aragog local]$ cd gdal-1.3.1/ [anthony3@aragog gdal-1.3.1]$ ./configure \ > --with-png \ > --with-libtiff \ > --with-jpeg \ > --with-gif \ > --with-pg=/usr/local/pgsql/bin/pg_config \ > --with-geos checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking target system type... i686-pc-linux-gnu . . . enable OGR building: yes [anthony3@aragog gdal-1.3.1]$ make GNUMakefile:43: warning: overriding commands for target 'libgdal.la' GNUMakefile:39: warning: ignoring old commands for target 'libgdal.la' (cd port; make) . . . make[1]: Leaving directory '/usr/local/gdal-1.3.1/apps' [anthony3@aragog gdal-1.3.1]$ make install GNUMakefile:43: warning: overriding commands for target 'libgdal.la' GNUMakefile:39: warning: ignoring old commands for target 'libgdal.la' (cd port; make) . . . /bin/sh ./libtool --mode=finish --silent /usr/local/lib [anthony3@aragog gdal-1.3.1]$
Unpacking the Source
[anthony3@aragog gdal-1.3.1]$ cd /usr/local/ [anthony3@aragog local]$ tar -xvzf mapserver-4.8.0-rc2.tar.gz mapserver-4.8.0-rc2/ mapserver-4.8.0-rc2/rfc/ mapserver-4.8.0-rc2/rfc/ms-rfc-1.txt . . . mapserver-4.8.0-rc2/mapparser.h [anthony3@aragog local]$
Configuring MapServer
[anthony3@aragog local]$ cd mapserver-4.8.0-rc2/ [anthony3@aragog mapserver-4.8.0-rc2]$ ./configure \ > --with-proj=/usr/local \ > --with-geos=/usr/local/bin/geos-config \ > --with-ogr=/usr/local/bin/gdal-config \ > --with-gdal=/usr/local/bin/gdal-config \ > --with-postgis=/usr/local/pgsql/bin/pg_config \ > --with-curl-config=/usr/bin/curl-config \ > --with-httpd=/usr/local/apache2/bin/httpd \ > --with-php=/usr/local/php-5.1.2 \ checking for gcc... gcc checking for a C compiler default output file name... a.out checking whether the C compiler works... yes . . . config.status: creating mapscript/java/Makefile [anthony3@aragog mapserver-4.8.0-rc2]$
Compiling MapServer
When compiling and installing MapServer, make sure that you are root, or have superuser privileges. For all examples in this documentation, user
anthony3has superuser privileges.[anthony3@aragog mapserver-4.8.0-rc2]$ make gcc -c -O2 -fPIC -Wall -DIGNORE_MISSING_DATA -DNEED_STRLCAT -DUSE_EPPL -DUSE_PROJ -DUSE_WMS_SVR -DUSE_GD_GIF -DUSE_GD_PNG -DUSE_GD_JPEG -DUSE_GD_WBMP -DUSE_GD_FT -DGD_HAS_GDIMAGEGIFPTR -DGD_HAS_GETBITMAPFONTS -DUSE_OGR -DUSE_GDAL -DUSE_ICONV -DUSE_POSTGIS -DUSE_ZLIB -I/usr/include -I/usr/local/include -I/usr/local/include -I/usr/local/pgsql/include -I/usr/local/include maptemplate.c -o maptemplate.o . . . make[1]: Leaving directory '/usr/local/mapserver-4.8.0-rc2/mapscript/php3' [anthony3@aragog mapserver-4.8.0-rc2]$ cp mapserv /usr/local/apache2/cgi-bin/. [anthony3@aragog mapserver-4.8.0-rc2]$ cp legend /usr/local/apache2/cgi-bin/. [anthony3@aragog mapserver-4.8.0-rc2]$ cp scalebar /usr/local/apache2/cgi-bin/. [anthony3@aragog mapserver-4.8.0-rc2]$ cp shp2img /usr/local/apache2/cgi-bin/. [anthony3@aragog mapserver-4.8.0-rc2]$ cp shp2pdf /usr/local/apache2/cgi-bin/. [anthony3@aragog mapserver-4.8.0-rc2]$ cp shptree /usr/local/apache2/cgi-bin/. [anthony3@aragog mapserver-4.8.0-rc2]$ cp shptreest /usr/local/apache2/cgi-bin/. [anthony3@aragog mapserver-4.8.0-rc2]$ cp shptreevis /usr/local/apache2/cgi-bin/. [anthony3@aragog mapserver-4.8.0-rc2]$ cp sortshp /usr/local/apache2/cgi-bin/. [anthony3@aragog mapserver-4.8.0-rc2]$ cp tile4ms /usr/local/apache2/cgi-bin/. [anthony3@aragog mapserver-4.8.0-rc2]$
Testing MapServer
[anthony3@aragog mapserver-4.8.0-rc2]$ /usr/local/apache2/cgi-bin/mapserv This script can only be used to decode form results and should be initiated as a CGI process via a httpd server. [anthony3@aragog mapserver-4.8.0-rc2]$The above output is what you want to see. Once you see this message, you are ready to build your MapServer application. HAPPY MAPPING!
This How-to applies to: MapServer 4.8
RE: Updated paths in postgis version 1.1.0
I have updated this document with the newest version of all software packages, as well as updated any and all paths that needed to be modified to reflect new versions.
If I am missing something, let me know. I'll fix/add it.
Anthony
typo
I think the line above in the PHP ./configure options:
> --with-gettext
needs a backslash appended to it:
> --with-gettext \
I much appreciate your work here. Please delete this comment after changing the page.
/nitpick
'nother
In the PostGIS unpacking step above, change:
tar -xvzf postis-1.1.0.tar.gz
to:
tar -xvzf postgis-1.1.0.tar.gz
or:
tar -xvzf postis-1.1.1.tar.gz
Thanks.
making a list
Possibly postgis-1.1.1 has created a change in the post compile configuration step for postgis-1.1.0 above where:
/usr/local/pgsql/bin/psql -d test -f /usr/local/pgsql/share/postgresql/contrib/lwpostgis.sql
becomes:
/usr/local/pgsql/bin/psql -d test -f /usr/local/pgsql/share/contrib/lwpostgis.sql
instead.
same thing for spatial reference table
/usr/local/pgsql/bin/psql -d test -f /usr/local/pgsql/share/postgresql/contrib/spatial_ref_sys.sql
becomes:
/usr/local/pgsql/bin/psql -d test -f /usr/local/pgsql/share/contrib/spatial_ref_sys.sql
in postgis-1.1.1.
in mapserver precompile configure step...
...remove the final trailing slash (from the --with-php option).
in the mapserver install step...
cp shptreest /usr/local/apache2/cgi-bin/.
should instead be:
cp shptreetst /usr/local/apache2/cgi-bin/.
ldconfig...
...should be run again after installing gdal in order to pick up libgdal.so.1 from /usr/local/lib, or the final mapserver test will not work.
chkconfig
The chkconfig lines for postgresql and apachectl should be changed from:
# chkconfig: - 85 15
to:
# chkconfig: 2345 85 15
chown and chmod for pgsql
If you want to be able to start postgresql through chkconfig 2345, then:
chown -R postgres:postgres /usr/local/pgsql chmod -R og-rwx /usr/local/pgsql/data
chkconfig starts /etc/init.d/postgresql as root and then setuids to postgres to run pg_ctl.
php_mapscript.so
add to last step of installing mapserver:
cp mapscript/php3/php_mapscript.so /usr/local/apache2/php/extensions/php_mapscript.so
PHP doesn't find freetype or libjpeg
If you are going to install Chameleon after this, you need to have a few extra things in your PHP configuration, because PHP configure isn't going to find your freetype or libjpeg when PHP is installed outside the FC4 repository tree. You'll notice this omission as PHP errors in you Apache logs if you don't do this. To be completely safe use:
--with-zlib \ --with-zlib-dir=/usr/lib \ --with-png-dir=/usr/lib \ --with-ttf \ --with-freetype-dir=/usr/lib \ --with-jpeg-dir=/usr/lib \ --with-tiff-dir=/usr/lib \ --with-bz2 \ --with-curl \ --enable-dbase \ --with-gd \ --with-pgsql=/usr/local/pgsql \
in addition to the other PHP configuration options in this recipe.
You can insure that gd is set up correctly from the FC4 repository by running gdlib-config --all and the output on FC4 should look like:
includedir: /usr/include cflags: -I/usr/include ldflags: -L/usr/lib -L/usr/X11R6/lib libs: -lXpm -lX11 -ljpeg -lfontconfig -lfreetype -lpng12 -lz -lm libdir: /usr/lib features: GD_XPM GD_JPEG GD_FONTCONFIG GD_FREETYPE GD_PNG GD_GIF
Some more things for your php.ini
You'll need this in php.ini:
extenion_dir = /usr/local/apache2/php/extensions upload_tmp_dir = /usr/local/tmp session.save_path = /usr/local/temp/sessions
You'll need to create directories writeable by the Apache run user: /usr/local/tmp and /usr/local/tmp/sessions
You'll need to write a cron job to go out and clean out those directories of files older than a few days.
Fedora Core 5 requires SELinux setting change
In order to get Apache (Apache 2.2) to restart after installing PHP 5.1.4, I had to change the SELinux settings to Permissive. Otherwise you get a syntax error and a permission denied error when attempting to load the PHP .so module.
installations problems
After carefully following all instructions of how to build mapserver in a linux environmet, I come to the last point,where all i have to do is execute the mapserv executable. However, the following occurs:
[root@localhost mapserver-4.8.1]# /usr/local/apache2/cgi-bin/mapserv
/usr/local/apache2/cgi-bin/mapserv: error while loading shared libraries: libpq.so.4: cannot open shared object file: No such file or directory
does anyone please have any idea about this? All steps until the mapserver execution have successfully done.
Thanks!
reply:installations problems
then i add to /etc/ld.so.conf this line :
/usr/local/pgsql/lib/
n then run ldconfig
then start mapserv by /usr/local/apache2/cgi-bin/mapserv
n the result is the same with this documentation
This script can only be used to decode from results and should be initiated as a CGI process via httpd server
i hope it help :)
unable to load libgdal.so
i found error when trying install gdal.
but it installed successfully when i remove my older rpm instalation n restart. and after that there were no error
but when i tried to check /usr/local/apache2/cgi-bin/mapserv it appeare an error message
/usr/local/apache2/cgi-bin/mapserv: error while loading shared libraries: libgdal.so.1: cannot open shared object file: No suchfile or directory.
i have tried to re-do the instalation step for mapserver.4.10 and also for gdal
but the error message keep showing.
is anyone can help me
my installed system:
1. FC5
2. httpd-2.2.3
3. postgresql-8.1.4
4. php-5.2.0
6. postgis-1.1.6
7. geos-2.2.3
8. proj-4.5.0
9. gdal-1.3.2
10. mapserver-4.10
ps : i have also tried to install the map-server-4.8 but it showed the same error message
thank you before .
Husnul
problem solved
:)
undefined reference to libjpeg
I get down to mapserver/make and get:
./libmap.a(mappdf.o)(.text+0x145f): In function `msDrawMarkerSymbolPDF':
: undefined reference to `gdImageJpegPtr'
gd and jpeg? Interestingly enough when i ./configure mapserver, I see:
checking for jpeg_read_header in -ljpeg... no
libjpeg not found. JPEG support not included, possibly needed for GD.
..
checking for gdImagePng in -lc... no
checking for gdImageJpeg in -lc... no
however...
[root@niceguy gd-2.0.33]# rpm -qa | grep "libjpeg"
libjpeg-6b-33
libjpeg-6b-33
libjpeg-devel-6b-33
I have libjpeg installed! Can anyone tell me what files or where I should put them or how to call the files that I have?
-desperate
thanks for any help!
-Ed
Error: libgdal.so.1
I repeat step by step the instructions and comments, but at the end I have this error message when I test it:
mirko:/usr/local/apache2/cgi-bin# /usr/local/apache2/cgi-bin/mapserv
/usr/local/apache2/cgi-bin/mapserv: error while loading shared libraries: libgdal.so.1: cannot open shared object file: No such file or directory
mirko:/usr/local/apache2/cgi-bin#
i try to run ldconfig after install gdal and mapserver...
My system on Debian Etch:
-httpd-2.2.6
-postgresql-8.2.5
-php-5.2.4
-proj-4.5.0
-geos-3.0.0rc4
-gdal-1.4.0
-mapserver-5.0.0
Can anyone help me?
Thanks a lot.
Mirko.
Error: libgdal.so.1
Add the follow line into your httpd.conf
SetEnv LD_LIBRARY_PATH /path/to/libgdal.so.1
and reload or restart apache.
Remark: If you want to start mapserv from the commandline for a quick check, you also have to set the enviroment variable LD_LIBRARY to this path:
export LD_LIBRARY_PATH=/path/to/libgdal.so.1
Updated paths in postgis version 1.1.0
During the step of "Post Compile PostGIS Configuration" the paths to the sql scripts have changed in postgis version 1.1.0 (I assume this is the program that creates these paths). In the text the paths are given as:
/usr/local/pgsql/share/contrib/lwpostgis.sql AND /usr/local/pgsql/share/contrib/spatial_ref_sys.sql
whereas the new paths are:
/usr/local/pgsql/share/postgresql/contrib/lwpostgis.sql AND /usr/local/pgsql/share/postgresql/contrib/spatial_ref_sys.sql
This might help if you are stuck..
Mikael