This is just a small script to download, configure and build mapserver and its main dependencies from sources under Linux. This HowTo assumes a basic knowledge of bash commands and the ability to edit the scripts itself and change a few configuration parameters.
How it worksFirst, all the libraries and mapserver will be downloaded from their official websites, then tey will be uncompressed and extracted on your disk, then they will be configured, built and installed one by one. Important note: after copying and pasting the script from this page to your PC, you will have to change “ and ″ in ” in the script. Note that you don’t have to run the script as root, run it as a normal user, you will be prompted for a password when needed. If your distribution doesn’t use the “sudo” system, just change all “sudo” commands in the script into “su -c “.
PrerequisitesBuilding from sources means you already have installed the compiler, its tools and the header files of all the main shared libraries (zlib etc.) and have a working toolchain for compilation from sources. This was tested on Linux KUbuntu, Ubuntu server and Debian.
ConfigurationAfter copying the script on the disk and making it executable, you should open it with an editor and change some configuration variables. More detailed instructions are in the script comments.
If something goes wrongFirst uncomment WGET in the code if you don’t want to download all files again, then check your paths and those configured or hardcoded in the script. Chek also the parameters passed to the “configure” commands in the script, maybe you don’t need all those options.
# Where to install: usually /usr or /usr/local PREFIX=/usr # Directory of PHP binary libs, in my case, was /usr/lib/php5/20051025/ PHPLIBDIR=/usr/lib/php5/20051025/ # Uncomment for a debug build of gdal library #DEBUG_GDAL=1 # Activate download (deactivate if you have still downloaded) WGET=1 # Libraries to fetch, configure, build and install # Adjust versions according to your needs GEOS="geos-3.0.0rc4" GDAL="gdal-1.4.1" PROJ="proj-4.5.0" MAPSERVER="mapserver-4.10.1" # Uncomment if you still have postgresql installed and want # to build postgis, adjust paths in the last code block of this file #POSTGIS="postgis-1.2.1" if [ $GEOS ]; then if [ $WGET = 1 && ! -f "$GEOS.tar.bz2" ]; then wget http://geos.refractions.net/$GEOS.tar.bz2 tar -xjf $GEOS.tar.bz2 fi cd $GEOS ./configure --prefix=$PREFIX make clean make sudo make install cd .. fi if [ $GDAL ]; then if [ $WGET = 1 ]; then wget http://download.osgeo.org/gdal/$GDAL.tar.gz tar -xzf $GDAL.tar.gz fi cd $GDAL if [ $DEBUG_GDAL ]; then export CFG=debug fi ./configure --prefix=$PREFIX --with-mysql make clean make sudo make install cd .. fi if [ $PROJ ]; then if [ $WGET = 1 ]; then wget ftp://ftp.remotesensing.org/proj/$PROJ.tar.gz tar -xzf $PROJ.tar.gz fi cd $PROJ ./configure --prefix=$PREFIX make clean make sudo make install sudo cp $PREFIX/include/proj_api.h $PREFIX/lib cd .. fi if [ $MAPSERVER ]; then if [ $WGET = 1 ]; then wget http://cvs.gis.umn.edu/dist/$MAPSERVER.tar.gz tar -xzf $MAPSERVER.tar.gz fi cd $MAPSERVER ./configure \ --with-wfs \ --with-wfsclient \ --with-wmsclient \ --with-proj=$PREFIX/lib \ --with-geos=$PREFIX/bin/geos-config \ --with-gdal=$PREFIX/bin/gdal-config \ --with-ogr=$PREFIX/bin/gdal-config \ --with-php=/usr/include/php5 \ --with-mygis=yes \ --with-postgis \ --with-httpd=/usr/sbin/apache2 \ --prefix=$PREFIX make clean make sudo cp mapserv /usr/lib/cgi-bin/ sudo cp shp2img $PREFIX sudo cp shptree $PREFIX sudo cp tile4ms $PREFIX sudo cp mapscript/php3/php_mapscript.so $PHPLIBDIR cd .. fi if [ $POSTGIS ]; then if [ $WGET = 1 && ! -f "$POSTGIS.tar.gz" ]; then wget http://www.postgis.org/download/$POSTGIS.tar.gz tar -xzf $POSTGIS.tar.gz fi cd $POSTGIS ./configure --prefix=$PREFIX/lib/postgresql/8.1/ make clean make sudo make install cd .. fi