Skip to content

Instantly share code, notes, and snippets.

@sztanko
Forked from springmeyer/install-tilemill-latest.sh
Last active December 16, 2015 07:19
Show Gist options
  • Save sztanko/5397800 to your computer and use it in GitHub Desktop.
Save sztanko/5397800 to your computer and use it in GitHub Desktop.
# 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*
# add new ppa's
sudo apt-get install software-properties-common -y
echo 'yes' | sudo apt-add-repository ppa:chris-lea/node.js-legacy
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 nodejs-dev npm git build-essential libgtk2.0-dev libwebkitgtk-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
wget http://download.osgeo.org/geos/geos-3.3.8.tar.bz2
tar xvfj geos-3.3.8.tar.bz2
cd geos-3.3.8
./configure
make -j -l 5
sudo make install
cd ..
wget http://download.osgeo.org/postgis/source/postgis-2.0.3.tar.gz
tar xfvz postgis-2.0.3.tar.gz
cd postgis-2.0.3
./configure
make -j -l 5
sudo make install
sudo ldconfig
sudo make comments-install
sudo ln -sf /usr/share/postgresql-common/pg_wrapper /usr/local/bin/shp2pgsql
sudo ln -sf /usr/share/postgresql-common/pg_wrapper /usr/local/bin/pgsql2shp
sudo ln -sf /usr/share/postgresql-common/pg_wrapper /usr/local/bin/raster2pgsql
# set up postgres
POSTGRES_VERSION=9.1 # you may need to change this
POSTGIS_VERSION="1.5" # you may need to change this
sudo apt-get install -y postgresql postgresql-server-dev-$POSTGRES_VERSION postgresql-$POSTGRES_VERSION-postgis
sudo su postgres
# we lost variables, reset them
POSTGRES_VERSION=9.1 # you may need to change this
POSTGIS_VERSION="1.5" # you may need to change this
createuser <your user> # yes to super
createdb template_postgis
createlang -d template_postgis plpgsql # you may not need this
POSTGIS_PATH=`pg_config --sharedir`/contrib/postgis-$POSTGIS_VERSION
psql -d template_postgis -f $POSTGIS_PATH/postgis.sql
psql -d template_postgis -f $POSTGIS_PATH/spatial_ref_sys.sql
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