MapServer on Arch Linux

MapServer isn’t in Arch‘s package repository.  There are two older versions in AUR, but they are not currently maintained.   Luckily, MapServer is very straight forward to compile and install on its own, it isn’t updated on a weekly basis so it is easy to keep current, and it is the sort of software that once you find a version that works for you you tend to want to keep it.  All this makes it a great candidate for you to compile and install it yourself.

To do so, make sure you have all the software and libraries that MapServer relies on installed.  You can use pacman to install the following packages:

sudo pacman -S libpng \
gd \
freetype2-infinality \
zlib \
proj \
gdal \
curl \
agg \
libtiff \
libgeotiff \
geos \
libjpeg \
libxml2 \
apache \
mod_fastcgi \

You can substitute lighttpd, or any other web server that supports cgi for apache.  Also, if you’re not going to be using PostGIS or any other geodatabase software you can probably leave of mod_fastcgi and just let the regular cgi handle MapServer.  If you are, however, fast cgi will normally be more responsive due to how it handles database connections.

Most, if not all, of those packages will be installed since they are used by most everyday software and/or GIS software you may already have installed.  Now you’re ready to set up MapServer.  Download the tarball of the latest latest version from here.  As of right now the latest version is 6.0.1.  Once it is downloaded, open a terminal window and navigate to where the file was downloaded.  You can extract it with the following command:

tar xvzf mapserver-6.0.1.tar.gz
cd mapserver-6.0.1

Personally before I extract the file I move it to another folder (~/builds is what I use but you can put it where ever works for you).

Once the file is extracted you’ll need to run configure so the compiler knows where all the programs and libraries it will need are located and which options you want in your MapServer.  For me I used the following options:

./configure --with-postgis=/usr/bin/pg_config \
--with-httpd=/usr/sbin/httpd \
--with-wfsclient \
--with-wmsclient \
--with-curl-config=/usr/bin/curl-config \
--with-tiff \
--with-gd=/usr/ \
--with-jpeg \
--with-freetype=/usr/ \
--with-threads \
--with-wcs \
--with-proj=/usr/ \
--with-geos=/usr/bin/geos-config \
--with-gdal \
--with-ogr \
--with-sos \
--with-png=/usr/ \
--with-kml \
--with-gd=/usr/ \
--with-agg-svg-symbols=YES \
--with-xml-mapfile=YES \

This turns on almost all the options MapServer provides.  I did leave out ArcSDE support since I don’t have access to it.  If there is something you don’t want or need you can just leave that option out.  Since I’m not using this on a production environment, just as a little project to keep myself busy, I turned on pretty much everything.

If all went well you’ll see a message similar to this:

MapServer is now configured for
-------------- Compiler Info -------------
 C compiler: gcc -O2 -fPIC -Wall -DNDEBUG
 C++ compiler: g++ -O2 -fPIC -Wall -DNDEBUG
 Generic NINT:
-------------- Renderer Settings ---------
 OpenGL support:
 zlib support: -DUSE_ZLIB
 png support: -DUSE_PNG
 gif support: -DUSE_GIF
 jpeg support: -DUSE_JPEG
 freetype support: -DUSE_FREETYPE
 iconv support: -DUSE_ICONV
 AGG support: internal
 SVG Symbol support: -DUSE_AGG_SVG_SYMBOLS
 Cairo (SVG,PDF) support: -DUSE_CAIRO
 KML support: -DUSE_KML

You’ll notice I did not turn on OpenGL support so there is nothing after the colon in the Renderer Settings section.  This shows there is not OpenGL support, but everything else will be available to MapServer.

If things did not go well the configure process will tell you give you an error message. Usually it is due to a missing library, check the Arch Repository for the missing program or library.  If you can’t find it there, try AUR.

If configure did go well you’re ready to compile.  All you need to do is run make:


Once make is done you’ll have a file called mapserv.  If you compiled MapServer with fastcgi support rename the file to mapserv.fcgi, if not leave the file as mapserv.  Just copy it to /srv/http/cgi-bin and you’re good to go. For fastcgi to work you’ll also need to change apache’s configuration.  See this wiki article on what changes need to be made.

For more information on how to compile, install, and use MapServer check out their excellent documentation.

    • SamTux
    • November 21st, 2012


  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: