Mapserver
This page is an attempt to make life easier to someone who is trying to install Mapserver on his/her computer. Please keep in mind that this worked out for my box's configuration and may not apply to other boxes. To install Mapserver the following tools are needed: Apache, PHP, PostgreSQL and of course Mapserver. In order to build a spatial database, PostGIS is required in order to use PostgreSQL . GD (www.boutell.com), Freetype and the Jpeg libraries are need as well, although in a typical Linux installation only GD needs to be downloaded in order to install Mapserver.
Installing PostGIS
Download PostGIS from http://refractions. If PostgreSQL was installed from source, most probably it is located under /usr/local/pgsql/src/. If it was installed from RPM (as in my case), download the source code of version that matches your PostgreSQL (use $psql -V to check which version you have). Untar the source code and copy the uncompressed PostGIS directory under /contrib on the PostgreSQL source directory and then compile PostGIS:
cp -r ./postgis-1.0.0 ./postgresql-8.0.0/contrib/
cd postgresql-8.0.0
./configure DO NOT RUN MAKE
contrib/postgis-1.0.0
make
su
make install
For some reason when I was trying to load PostGIS into my database it didn't work, and the problem was that PostGIS was looking for a libraries which was not located in the appropriate directory.
cp /usr/local/pgsql/lib/liblwgeom.so.1.0 /usr/lib/pgsql/
And now the final test
createdb test
createlang plpgsql test
psql -d test -f lwpostgis.sql
psql -d test -f spatial_ref_sys.sql
Installing Apache
Download Apache and install it
./configure --enable-so --enable-rewrite make make install
Installing PHP
Depending on the PHP version being installed, libxml2 version 2.5.10 or greater might be required.
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-pgsql=/home/jaime/install/postgresql-8.0.0/src/interfaces/libpq/ --with-freetype-dir=/usr/include/freetype2/ --with-jpeg-dir=/usr/include/ --with-tiff-dir=/usr/include/ --prefix=/usr/local/apache2/php --with-config-file-path=/usr/local/apache2/php --with-config-file-path=/usr/local/apache2/php --with-gd --with-zlib
Installing Mapserver
After several attempts to configure mapserver, the final options were:./configure --with-xpm=/usr/X11R6 --with-php=/usr/local/apache2/php --with-postgis=/home/jaime/install/postgresql-8.0.0/src/bin/pg_config/pg_config --with-proj --with-gd=/home/jaime/install/gd-2.0.33/ --with-gdal --with-ogr --with-php-regex-dir=/home/jaime/install/php-5.0.4/regex --with-httpd=/usr/local/apache2/bin/httpd
To complete the installation, copy the mapserv file to the web server's cgi-bin directory and php_mapscript.so to php/extensions:
cp mapserv /usr/local/apache2/cgi-bin/
cp php_mapscript.so /usr/local/lib/php/extensions/no-debug-non-zts-20041030/
Getting started
Once Mapserver has been installed it is time to start working on it. A good start is the Mapserver 4.0 tutorial which is divided in different sections.