Skip to content

Instantly share code, notes, and snippets.

@springmeyer
Last active January 6, 2024 15:06
  • Star 18 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save springmeyer/3427021 to your computer and use it in GitHub Desktop.
Mapnik on Amazon Linux AMI (Fedora)
# http://aws.amazon.com/amazon-linux-ami/
# http://aws.amazon.com/amazon-linux-ami/faqs/
# Boot up a machine with at least 1.5 to 2 GB Ram
# login
chmod 600 key.pem
ssh -i key.pem ec2-user@ec2...compute.amazonaws.com
# update
sudo yum -y update
sudo yum -y upgrade
# enable EPEL6 by changing enabled=0 -> enabled=1
sudo vim /etc/yum.repos.d/epel.repo
# install deps
sudo yum -y install make gcc47 gcc-c++ bzip2-devel libpng-devel libtiff-devel zlib-devel libjpeg-devel libxml2-devel python-setuptools git-all python-nose python27-devel python27 proj-devel proj proj-epsg proj-nad freetype-devel freetype libicu-devel libicu
# install optional deps
sudo yum -y install gdal-devel gdal postgresql-devel sqlite-devel sqlite libcurl-devel libcurl cairo-devel cairo pycairo-devel pycairo
JOBS=`grep -c ^processor /proc/cpuinfo`
# build recent boost
export BOOST_VERSION="1_55_0"
export S3_BASE="http://mapnik.s3.amazonaws.com/deps"
curl -O ${S3_BASE}/boost_${BOOST_VERSION}.tar.bz2
tar xf boost_${BOOST_VERSION}.tar.bz2
cd boost_${BOOST_VERSION}
./bootstrap.sh
./b2 -d1 -j${JOBS} \
--with-thread \
--with-filesystem \
--with-python \
--with-regex -sHAVE_ICU=1 \
--with-program_options \
--with-system \
link=shared \
release \
toolset=gcc \
stage
sudo ./b2 -j${JOBS} \
--with-thread \
--with-filesystem \
--with-python \
--with-regex -sHAVE_ICU=1 \
--with-program_options \
--with-system \
toolset=gcc \
link=shared \
release \
install
cd ../
# set up support for libraries installed in /usr/local/lib
sudo bash -c "echo '/usr/local/lib' > /etc/ld.so.conf.d/boost.conf"
sudo ldconfig
# mapnik
# stable branch: 2.3.x
git clone https://github.com/mapnik/mapnik -b 2.3.x
cd mapnik
./configure
make
make test-local
sudo make install
# node
NODE_VERSION="0.10.26"
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 -j${JOBS}
sudo make install
cd ../
# install protobuf libs needed by node-mapnik
sudo yum -y install protobuf-devel protobuf-lite
# Then workaround package bugs:
# 1) 'pkg-config protobuf --libs-only-L' misses -L/usr/lib64
# do this to fix:
export LDFLAGS="-L/usr/lib64"
# 2) '/usr/lib64/libprotobuf-lite.so' symlink is missing
# do this to fix:
sudo ln -s /usr/lib64/libprotobuf-lite.so.8 /usr/lib64/libprotobuf-lite.so
# otherwise you will hit: '/usr/bin/ld: cannot find -lprotobuf-lite' building node-mapnik
# node-mapnik
git clone https://github.com/mapnik/node-mapnik
cd node-mapnik
npm install
npm test
cd ../
# tilemill
git clone https://github.com/mapbox/tilemill
cd tilemill
vim package.json # remove the 'topcube' line since the GUI will not work on fedora due to lacking gtk/webkit
npm install
./index.js --server=true # view on http://localhost:20009, more info: http://mapbox.com/tilemill/docs/guides/ubuntu-service/
@radzhome
Copy link

radzhome commented Jan 2, 2015

Doesn't install gdal on amazon linux 2014.09 , This is what happens:

--> Finished Dependency Resolution
Error: Package: gdal-libs-1.9.2-6.rhel6.x86_64 (pgdg93)
           Requires: libpoppler.so.5()(64bit)
Error: Package: gdal-java-1.9.2-6.rhel6.x86_64 (pgdg93)
           Requires: libpoppler.so.5()(64bit)
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

skip-broken doesn't fix the issue either. Any way to get gdal installed without compiling from source on the new Amazon Linux AMI? Its required for postgis running in AWS Elastic Beanstalk.

@antonakv
Copy link

Any update here ?
I have the same issue with Amazon Linux AMI release 2015.03

---> Package gdal-libs.x86_64 0:1.9.2-6.rhel6 will be installed
--> Processing Dependency: libpoppler.so.5()(64bit) for package: gdal-libs-1.9.2-6.rhel6.x86_64
---> Package libquadmath.x86_64 0:4.8.2-16.2.99.amzn1 will be installed
--> Finished Dependency Resolution
Error: Package: gdal-libs-1.9.2-6.rhel6.x86_64 (pgdg94)
Requires: libpoppler.so.5()(64bit)
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest

@porjo
Copy link

porjo commented Jul 16, 2016

Have tried this on latest Amazon Linux AMI but got various errors at the npm install stage. Can anyone confirm recent success with this script?

@JulieGoldberg
Copy link

I'm using this as a guide to try an install on a CentOS 7 VM (not an Amazon box yet), and I can't get things to work. I'm skipping the boost stuff, because I can install boost with yum now. I only get warnings, not errors, on any installation, but when I run "npm test" in either tilemill (whose URL has to be updated) or in node-mapnik, I get the error that GLIBCXX_3.4.20 isn't found.

For what it's worth, I need the mapnik python bindings, and I don't care about using it from node. I think that I need this before I can install python-mapnik but I'm not sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment