Installing Mapnik and Tilemill from source on Fedora

I’ve had my fair share of frustrations with jhbuild, so I find that I am surprisingly patient, and observant and my source-building muscles seem well-oiled. Today I installed Mapnik and Tilemill after running into a few troubles.

Here’s the brief for someone else with a Fedora machine, who might perhaps struggle lesser with these instructions. The instructions are mirrored from here but written for the Fedora user. Mostly, I have replaced all debian packages with the corresponding rpms from Fedora to save you a lot of searching and marked fixes for some specific issues that I encountered. Note that some of the packages I have included might well be unnecessary but I hope you will excuse that as one of my newbie misgivings.

1) Install development headers for boost dependencies.

sudo yum install make automake gcc gcc-c++ kernel-devel \
bzip2-devel.x86_64 python-devel.x86_64 libicu-devel.x86_64

2) Install Boost from source

wget http://mapnik.s3.amazonaws.com/deps/boost_1_54_0.tar.bz2
tar xjvf boost_1_54_0.tar.bz2
cd boost_1_54_0
./bootstrap.sh
./b2 stage toolset=gcc --with-thread --with-filesystem --with-python 
--with-regex -sHAVE_ICU=1 -sICU_PATH=/usr/ --with-program_options 
--with-system link=shared
sudo ./b2 install toolset=gcc --with-thread --with-filesystem 
--with-python --with-regex -sHAVE_ICU=1 -sICU_PATH=/usr/ 
--with-program_options --with-system link=shared -d0
sudo ldconfig && cd ../

3)Now install the remaining Mapnik dependencies like icu, proj4, libpng, libjpeg, libtiff, libxml2, libltdl, and freetype.

sudo yum install libxml2-devel.x86_64 \
freetype-devel-2.4.11-7.fc19.x86_64 libjpeg-turbo-devel.x86_64 \
libpng-devel.x86_64  proj-devel.x86_64 libtiff-devel.x86_64 \
cairo-devel-1.12.14-2.fc19.x86_64 cairo-dock-python3.x86_64 \
libgda-devel.x86_64 postgresql-server.x86_64 \
postgresql-contrib.x86_64 libsqlite3x-devel.x86_64 \
libpqxx-devel.x86_64 gdal-python.x86_64 gdal-devel.x86_64 \
gdal-libs.x86_64 proj-epsg.x86_64 proj-static.x86_64 proj-nad.x86_64 \
pycairo-devel.x86_64

4) Now download the latest Mapnik release and build it from scratch:

wget http://mapnik.s3.amazonaws.com/dist/v2.2.0/mapnik-v2.2.0.tar.bz2
tar xf mapnik-v2.2.0.tar.bz2
cd mapnik-v2.2.0

NOTE: Add osm in config.py in the first line to list of INPUT PLUGINS, so your config.py should read as follows

INPUT_PLUGINS = 'csv,gdal,geojson,ogr,osm,postgis,raster,shape,sqlite'
BOOST_INCLUDES = '/usr/local/include'
BOOST_LIBS = '/usr/local/lib'
BINDINGS = 'python'

Make install

./configure && make && sudo make install

5)make test && cd ../

Possible Issues

5.1 http://fpaste.org/161612/ – fixed by installing proj-epsg.x86_64

sudo yum install proj-epsg.x86_64

5.2 http://fpaste.org/161616/95740141/ – fixed by including ‘osm’ in the list of INPUT_PLUGINS as mentioned in STEP 4 or if you don’t want that, replace tests/python_tests/save_map_test.py with the file from here

This ensures that tests are only run for plugins in the INPUT_PLUGINS list and ignores all the tests for osm, but if you want those tests to work, you must include osm in the list of INPUT_PLUGINS in config.py run this part of STEP 4 again

./configure && make && sudo make install

6)I already had nodeJS installed, which I simply picked of the main nodeJS site and built from source in the normal way. The mapbox website recommended way should also work:

NODE_VERSION="0.10.13"
wget http://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}.tar.gz
tar xf node-v${NODE_VERSION}.tar.gz
cd node-v${NODE_VERSION}
./configure && make && sudo make install
cd ../

7)For the Desktop Windowing UI for Tilemill, I simply installed libwebkit2gtk.x86_64 because I have a GNOME desktop. Pick an equivalent here.

sudo yum install libwebkit2gtk.x86_64

8)Install Google Protobuf library

sudo yum install protobuf-compiler.x86_64 protobuf-lite-devel.x86_64 \
protobuf-lite-static.x86_64

9) Install Tilemill

git clone https://github.com/mapbox/tilemill.git
cd tilemill
npm install
Follow

Get every new post delivered to your Inbox.