Installing Mapnik on CentOS 5

Instructions are provide at the mapnik website for installation on CentOS or Redhat. But unfortunately they are a little out of date and just didnt work for me. This guide provides the steps needed to install mapnik on CentOS 5.

Mapnik requires Python 2.5 or above and CentOS ships with 2.4 so first we will install python 2.6.  If you are running a 32 bit operating system you can download this repo file and place in /etc/yum.repos.d.

# wget
# mv geekymedia.repo /etc/yum.repos.d/
# yum install python26 python26-devel

But if you are running a 64 bit operating system python is going to need to be built from source. Download the latest version of python from here.

# wget
# tar zxvf Python-2.6.5.tgz
# cd Python-2.6.5
# ./configure
# make && make install

CentOS ships with boost, but is missing some components that mapnik will need. Because of this we will need to compile our own copy of boost. First install all of your dependencies

# yum install freetype-devel libtool-ltdl-devel libpng-devel libtiff-devel libjpeg-devel gcc-c++ libicu-devel bzip2-devel libxml2-devel

Now download the source code for boost from here

# wget
# tar zxvf boost_1_43_0.tar.gz
# cd boost_1_43_0
# ./

Before we can begin the build we need to point boost to Python 2.6. edit project-config.jam and edit this line:

# Python configuration
using python : 2.4 : /usr ;

to this:

# Python configuration
using python : 2.6 : /usr ;

Now we begin the build

# ./bjam

This can take quite a while to compile. So grab some coffee or read this

Once it is done compiling we need to add /usr/local/lib to our linker path and move boost to this directory

# cp -rfv stage/lib/* /usr/local/lib/
# cp -rf boost /usr/local/include
# vi /etc/
# /sbin/ldconfig

Next install PROJ.4 from source. Download here

# wget
# tar zxvf proj-4.7.0.tar.gz
# cd proj-4.7.0
# ./configure && make && make install

Now we need to download and compile mapnik. You can get the source from here

# wget
# bzip2 -d mapnik-0.7.1.tar.bz2
# tar xvf mapnik-0.7.1.tar
# cd mapnik-0.7.1
# python26 scons/ configure
# python26 scons/ install

And that’s it. You can test to ensure that it is properly installed with the following

# python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mapnik

If you do not get an error message you know you got everything right

3 Responses to “Installing Mapnik on CentOS 5”

  1. Andrew says:

    When I tried this I needed


    in /etc/

  2. Mohammad says:


    I followed the above steps on an updated CentOS-5.5 (32-bit) …
    Every thing went on perfectly except the last step!
    When configuring Mapnik for installation (i.e. # python26 scons/ configure) it says:
    “Boost version 1.34 or greater is requred”
    Why it can’t find the boost I have installed lately?! Am I missing something?!
    You can be sure that I followed every step above.

    Looking forward to your reply …

    Thanks in advance

  3. Raul says:

    After adding
    to /etc/, you should execute

Leave a Reply

See also: