Skip to content

Instantly share code, notes, and snippets.

@skorasaurus
Forked from springmeyer/install-tilemill-latest.sh
Last active December 19, 2015 06:28
Show Gist options
  • Save skorasaurus/5911182 to your computer and use it in GitHub Desktop.
Save skorasaurus/5911182 to your computer and use it in GitHub Desktop.
Installs a bleeding-edge Tilemill but for those with postgis 2.0 AND ubuntu 12.04 by running install-tilemil-latest.sh You do not need to use the mapnik-from-source.sh
# running tilemill masters, mapnik 2.x
# for ubuntu 12.04 users, postgis2.0 users
#
# modified https://gist.github.com/springmeyer/2164897
#
# clear out any old ppa's that might conflict
sudo rm /etc/apt/sources.list.d/*mapnik*
sudo rm /etc/apt/sources.list.d/*developmentseed*
sudo rm /etc/apt/sources.list.d/*chris-lea*
# install if not already, req'd for add-apt-repository
sudo apt-get install python-software-properties
# add new ppa's
echo 'yes' | sudo apt-add-repository ppa:chris-lea/node.js
echo 'yes' | sudo add-apt-repository ppa:mapnik/v2.2.0
echo 'yes' | sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
#for 3.0.0
#echo 'yes' | sudo apt-add-repository ppa:mapnik/nightly-trunk
# update
sudo apt-get -y update
sudo apt-get -y upgrade
# install nodejs latest and a few tilemill deps
sudo apt-get install -y nodejs git build-essential libgtk2.0-dev \
libwebkitgtk-dev protobuf-compiler libprotobuf-lite7 libprotobuf-dev \
libgdal1-dev
# Now, either install mapnik latest from packages
# Or see file below for installing mapnik from source
# and skip this line
sudo apt-get install -y libmapnik-dev mapnik-utils
# set up postgres
POSTGRES_VERSION=9.1
POSTGIS_VERSION="2.0"
sudo apt-get install -y postgresql postgresql-contrib-$POSTGRES_VERSION postgresql-server-dev-$POSTGRES_VERSION postgresql-$POSTGRES_VERSION-postgis-$POSTGIS_VERSION
sudo su postgres
# we lost variables, reset them
POSTGRES_VERSION=9.1
POSTGIS_VERSION="2.0"
createuser <your user> # yes to super
createdb template_postgis
psql -d template_postgis -c "CREATE EXTENSION postgis;"
psql -d template_postgis -c "CREATE EXTENSION postgis_topology;" # if you want topology
# psql -d template_postgis -c "CREATE EXTENSION hstore;" # if you want hstore
exit
# build tilemill
git clone https://github.com/mapbox/tilemill.git
cd tilemill
npm install
# then start it...
# if you are running a desktop server then just boot using all the defaults
./index.js # should open a window automatically, but you can also view at http://localhost:20009
# if you are running a headless server then the easiest thing to do
# to get a visual look at the running application is to tunnel using ssh.
# Do this from your local machine:
TILEMILL_HOST=<remote-ip>
ssh -CA ubuntu@${TILEMILL_HOST} -L 20009:localhost:20009 -L 20008:localhost:20008
# if you are using AWS then you can also pass `-i your.pem`
# then on the remove machine do
./index.js --server=true
# now TileMill is available on your local machine at http:://localhost:20009
# Or, install proj4 latest and then mapnik from source:
wget http://download.osgeo.org/proj/proj-datumgrid-1.5.zip
# we use trunk instead for better threading support
svn co http://svn.osgeo.org/metacrs/proj/trunk/proj proj-trunk # at the time pre-release 4.8.0
cd proj-trunk/nad
unzip -o ../../proj-datumgrid-1.5.zip
cd ../
./configure
make
make install
# grab boost PPA for recent enough version
sudo add-apt-repository ppa:mapnik/boost
sudo apt-get update
sudo apt-get install -y libboost-dev libboost-filesystem-dev libboost-program-options-dev libboost-python-dev libboost-regex-dev libboost-system-dev libboost-thread-dev
# mapnik dev deps
sudo apt-get install -y g++ cpp \
libicu-dev \
libboost-filesystem-dev \
libboost-program-options-dev \
libboost-python-dev libboost-regex-dev \
libboost-system-dev libboost-thread-dev \
python-dev libxml2 libxml2-dev \
libfreetype6 libfreetype6-dev \
libjpeg-dev \
libltdl7 libltdl-dev \
libpng-dev \
libproj-dev \
libgeotiff-dev libtiff-dev libtiffxx0c2 \
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
# mapnik sources
git clone http://github.com/mapnik/mapnik
cd mapnik
./configure CXX=clang++
make && sudo make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment