Table of Contents
Installing Mapnik on Ubuntu
For all versions of Ubuntu make sure you are up to date before starting to install:
sudo apt-get update sudo apt-get upgrade
For previous versions see that archived notes at UbuntuInstallationOld
Ubuntu Karmic
Karmic has Mapnik packages for 0.6.1, so you can either install Mapnik from packages or source.
- Packages are available in the 'universe' repositories so make sure your /etc/apt/sources.list has the below lines:
deb http://us.archive.ubuntu.com/ubuntu/ karmic universe deb http://us.archive.ubuntu.com/ubuntu/ karmic-updates universe
Install from packages
sudo apt-get install python-cairo libmapnik0.6 mapnik-utils python-mapnik
Note: then you will likely want to install Postgres 8.4 + PostGIS 1.4 (see below)
Install Mapnik from source
Set up
# get a build environment going... sudo apt-get install -y g++ cpp \ libboost1.40-dev libboost-filesystem1.40-dev \ libboost-iostreams1.40-dev libboost-program-options1.40-dev \ libboost-python1.40-dev libboost-regex1.40-dev \ libboost-thread1.40-dev \ libxml2 libxml2-dev \ libfreetype6 libfreetype6-dev \ libjpeg62 libjpeg62-dev \ libltdl7 libltdl-dev \ libpng12-0 libpng12-dev \ libgeotiff-dev libtiff4 libtiff4-dev libtiffxx0c2 \ libcairo2 libcairo2-dev python-cairo python-cairo-dev \ libcairomm-1.0-1 libcairomm-1.0-dev \ ttf-dejavu ttf-dejavu-core ttf-dejavu-extra \ subversion build-essential python-nose # also a bug in cairomm requires manually grabbing libsigc++: # https://bugs.launchpad.net/ubuntu/+source/cairomm/+bug/452733 sudo apt-get install libsigc++-dev libsigc++0c2 libsigx-2.0-2 libsigx-2.0-dev # install plugin dependencies sudo apt-get install libgdal1-dev python-gdal \ postgresql-8.4 postgresql-server-dev-8.4 postgresql-contrib-8.4 \ libsqlite3-dev # note, the postgis package is not available for postgres-8.4, so install it from source... wget http://postgis.refractions.net/download/postgis-1.4.0.tar.gz tar xzf postgis-1.4.0.tar.gz cd postgis-1.4.0 ./configure && make && sudo make install
Then compile and install Mapnik
svn co http://svn.mapnik.org/tags/release-0.7.0/ mapnik cd mapnik python scons/scons.py configure INPUT_PLUGINS=all OPTIMIZATION=3 SYSTEM_FONTS=/usr/share/fonts/truetype/ttf-dejavu/ python scons/scons.py sudo python scons/scons.py install
Then run:
$ sudo ldconfig
To test mapnik:
$ Python >>> import mapnik >>>
- No output is good. If you get errors about missing libs make sure 'usr/local/lib' is in /etc/ld.so.conf:
$ more /etc/ld.so.conf ## if `/usr/local/lib` is not with that file try: $ echo "/usr/local/lib" >> /etc/ld.so.conf # ldconfig
- Note: If your system is 64 bit, then /etc/ld.so.conf should include /usr/local/lib64 instead of /usr/local/lib
$ more /etc/ld.so.conf ## if `/usr/local/lib` is not with that file try: $ echo "/usr/local/lib64" >> /etc/ld.so.conf $ sudo ldconfig
- Note: Ubuntu version >= (8.10) should already have /usr/local/lib in /etc/ld.so.conf.d/, so try:
more /etc/ld.so.conf.d/libc.conf
If you are interested what libraries mapnik linked against do (for example):
ldd /usr/lib/python2.5/site-packages/mapnik/_mapnik.so | grep boost
