Recently I was struggling a bit to install Tilestache on a Ubuntu 16.04 server. Below are the steps that finally made it work. The server IP was 192.168.1.122
(install Ubuntu 16.04 LTS) (sudo apt-get openssh-server) (for ssh access) sudo apt-get update sudo apt-get install apache2 sudo apt-get install zlib1g-dev sudo apt-get install libjpeg-dev sudo apt-get install python-dev sudo apt-get install python-setuptools sudo easy_install tilestache
edit /etc/tilestache.cfg (sudo nano or something similar)
{ "cache": { "name": "Disk", "path": "/tmp/stache", "umask": "0000" }, "layers": { "osm": { "provider": {"name": "proxy", "provider": "OPENSTREETMAP"} } } }
NB: For a persistent cache, you may consider using a different location instead of /tmp, for instance /var/tilestache
Test by running tilestache standalone:
tilestache-server.py -c /etc/tilestache.cfg -i 0.0.0.0
browse:
http://192.168.1.122:8080/osm/preview.html
Install as WSGI program:
sudo apt-get install libapache2-mod-wsgi sudo mkdir /var/www/wsgi
edit /var/www/wsgi/tilestache.wsgi:
import os, TileStache application = TileStache.WSGITileServer('/etc/tilestache.cfg')
edit /etc/apache2/sites-enabled/000-default.conf (add 1 line)
ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined WSGIScriptAlias /tilestache /var/www/wsgi/tilestache.wsgi
Keep python happy and restart web server:
cd /var/www sudo mkdir .python-eggs sudo chmod 777 .python-eggs sudo service apache2 restart
browse:
http://192.168.1.122/tilestache/osm/0/0/0.png
http://192.168.1.122/tilestache/osm/preview.html
using tiles by leaflet: change
var osmUrl='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
to:
var osmUrl='http://192.168.1.122/tilestache/osm/{z}/{x}/{y}.png';
shell script for seeding: (seed.sh)
#!/bin/sh # World north=80 west=-180 south=-80 east=180 tilestache-seed.py -b $north $west $south $east \ -c /etc/tilestache.cfg -l osm 0 1 2 3 4 # Netherlands north=53.777 west=2.99 south=50.631 east=53.194 tilestache-seed.py -b $north $west $south $east \ -c /etc/tilestache.cfg -l osm 5 6 7 8 # Den Haag north=52.137 west=4.240 south=51.999 east=4.443 tilestache-seed.py -b $north $west $south $east \ -c /etc/tilestache.cfg -l osm 9 10 11 12 13
for zoom levels: see http://wiki.openstreetmap.org/wiki/Zoom_levels