UbuntuInstallation - plepe/mapnik GitHub Wiki
Installing Mapnik on Ubuntu
For all versions of Ubuntu it is a good idea to be fully up to date before starting:
sudo apt-get update
sudo apt-get upgrade
For older versions, see the archived notes at UbuntuInstallationOld
If you are intending to install Tilemill from a package/ppa, do not follow the directions below in order to avoid package conflicts. Instead, directly proceed to install Tilemill. Mapnik will automatically be installed with your Tilemill installation because it is available in the TileMill PPA.
Ubuntu >= (11.10)
Install from packages
First, ensure add-apt-repository is installed:
sudo apt-get install -y python-software-properties
Mapnik v2.2.0
This is the latest in the 2.2.x series.
sudo add-apt-repository ppa:mapnik/v2.2.0
sudo apt-get update
sudo apt-get install libmapnik libmapnik-dev mapnik-utils python-mapnik
These packages come from: https://launchpad.net/~mapnik/+archive/v2.2.0/+packages
Mapnik v2.3.x
This is the nightly build of the upcoming 2.3.0 release
sudo add-apt-repository ppa:mapnik/nightly-2.3
sudo apt-get update
sudo apt-get install libmapnik libmapnik-dev mapnik-utils python-mapnik
# also install datasource plugins if you need them
sudo apt-get install mapnik-input-plugin-gdal mapnik-input-plugin-ogr\
mapnik-input-plugin-postgis \
mapnik-input-plugin-sqlite \
mapnik-input-plugin-osm
These packages come from: https://launchpad.net/~mapnik/+archive/nightly-2.3/+packages
For nightly builds from master (3.0.0-pre)
This is the latest development code - built nightly - directly from https://github.com/mapnik/mapnik/commits/master
sudo add-apt-repository ppa:mapnik/nightly-trunk
sudo apt-get update
sudo apt-get install libmapnik libmapnik-dev mapnik-utils python-mapnik
sudo apt-get install mapnik-input-plugin-gdal mapnik-input-plugin-ogr\
mapnik-input-plugin-postgis \
mapnik-input-plugin-sqlite \
mapnik-input-plugin-osm
These packages come from: https://launchpad.net/~mapnik/+archive/nightly-trunk/+packages
Install Mapnik from source
First, remove any other old mapnik packages:
sudo apt-get purge libmapnik* mapnik-utils python-mapnik
Ensure your boost version is recent enough (at least 1.47)
Mapnik master may require a boost version more recent than provided by your Ubuntu distribution.
Ubuntu 12.04 Precise ships with 2 different boost versions: 1.46 and 1.48. Make sure you install the correct version (see below) or use the latest Boost version (that works with Mapnik) by installing Boost from the mapnik/boost PPA:
sudo add-apt-repository ppa:mapnik/boost
sudo apt-get update
sudo apt-get install libboost-dev libboost-filesystem-dev libboost-program-options-dev libboost-python-dev libboost-regex-dev libboost-system-dev libboost-thread-dev
Note: You can see the boost version offered by your distro with the below command. And if you are using the above PPA then its version should show up as a candidate for installation:
apt-cache policy libboost-dev
Set up build environment
# On Ubuntu 12.04 Precise, make sure you get the 1.48 boost packages:
sudo apt-get install \
libboost-filesystem1.48-dev \
libboost-program-options1.48-dev \
libboost-python1.48-dev libboost-regex1.48-dev \
libboost-system1.48-dev libboost-thread1.48-dev
# On newer system or if you've activated the mapnik PPA, then use this:
sudo apt-get install \
libboost-filesystem-dev \
libboost-program-options-dev \
libboost-python-dev libboost-regex-dev \
libboost-system-dev libboost-thread-dev \
# get a build environment going...
sudo apt-get install \
libicu-dev \
python-dev libxml2 libxml2-dev \
libfreetype6 libfreetype6-dev \
libjpeg-dev \
libltdl7 libltdl-dev \
libpng-dev \
libproj-dev \
libtiff-dev \
libcairo2 libcairo2-dev python-cairo python-cairo-dev \
libcairomm-1.0-1 libcairomm-1.0-dev \
ttf-unifont ttf-dejavu ttf-dejavu-core ttf-dejavu-extra \
git build-essential python-nose clang \
libgdal1-dev python-gdal \
postgresql-9.1 postgresql-server-dev-9.1 postgresql-contrib-9.1 postgresql-9.1-postgis \
libsqlite3-dev
Download, compile and install harfbuzz
wget http://mapnik.s3.amazonaws.com/deps/harfbuzz-0.9.24.tar.bz2
tar xf harfbuzz-0.9.24.tar.bz2
cd harfbuzz-0.9.24
./configure && make && sudo make install
sudo ldconfig
cd ../
Then compile and install Mapnik
# For the development branch:
git clone https://github.com/mapnik/mapnik
# Or instead download the latest version (currently 2.1.0):
wget https://github.com/downloads/mapnik/mapnik/mapnik-v2.1.0.tar.bz2
tar xfj mapnik-v2.1.0.tar.bz2
mv mapnik-v2.1.0 mapnik
# Then start compiling
cd mapnik
./configure && make && sudo make install
To test mapnik:
make test