Setup development environment using Vagrant

Hiroshi Miura edited this page Jan 30, 2014 · 2 revisions

How to setup development server of OSM TileMan using Vagrant

Install Virtualbox or a other supported virtual machine software.

This installation manual uses Virtualbox on MacOS X as the development environment.

An author uses QEMU/KVM on Ubuntu 12.04.2(LTS) 64bit with PPA

Install Vagrant

Download Vagrant and install it from ( I used v1.4.3 at writing this article. )

Clone TileMan github repository

local% git clone
local% cd tileman

init repository as vagrant work directory

local% vagrant init

Edit Vagrantfile

Edit Vagrantfile for enabling port forwarding or adding your favorite conditions.

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config| = "precise64"
  config.vm.provision :shell, :path => ""

  ## If you want to load test db and run test automatically, 
  ## enable a part of commented out.
  # config.vm.provision :shell, :path => "test/"
  # config.vm.provision :shell, :path => "test/"

  # please run:
  #  $ vagrant init
  #  $ vagrant box add precise64 <URL>
  #  $ vagrant up --provider=kvm  # if you use kvm
  config.vm.provider :virtualbox do |vb, override|     = "precise64"
   override.vm.box_url = ""
  config.vm.provider :kvm do |kvm, override| 
    kvm.gui = true     = "precise64"
    override.vm.box_url = ""

  # Create a forwarded port mapping which allows access to a specific port
  # within the machine from a port on the host machine. 
  # :forwarded_port, guest: 80, host: 8080

  # Create a private network, which allows host-only access to the machine
  # using a specific IP.
  # :private_network, ip: ""


Vagrant Up and provision

Type vagrant up command at the directory on cloned tileman directory where Vagrantfile exist.

local% vagrant up
[default] Importing base box 'precise64'...
[default] The guest additions on this VM do not match the install version of
VirtualBox! This may cause things such as forwarded ports, shared
folders, and more to not work properly. If any of those things fail on
this machine, please update the guest additions and repackage the

Guest Additions Version: 4.2.0
VirtualBox Version: 4.2.8
[default] Matching MAC address for NAT networking...
[default] Clearing any previously set forwarded ports...
[default] Forwarding ports...
Processing triggers for man-db ...
Setting up m4 (1.4.16-2ubuntu1) ...
Setting up autoconf (2.68-1ubuntu2) ...
Setting up automake (1:1.11.3-1ubuntu2) ...
using /usr/bin/automake-1.11 to provide /usr/bin/automake (automake) in auto mode.

Setting up autopoint ( ...
Setting up dh-autoreconf (5ubuntu1) ...

The command will install Ubuntu with below tools:

  1. OpenResty(nginx)
  2. Mapnik
  3. Tirex
  4. TileMan

This process will take long time. Good timing for getting coffee ;)

Running nginx

Make TileMan enable and restart openresty/nginx

vagrant@precise64:$ sudo ln -s /etc/nginx/sites-available/tileman-proxy /etc/nginx/sites-enabled/tileman-proxy
vagrant@precise64:$ sudo service nginx reload


You can access to the nginx process using port 8080 from your local machine as written in the rule in the Vagrantfile. And the TileMan server's VirtualHost is named 'tile'. So you have to add 'tile' entry on your local hosts file (not on the remote host).

local% sudo vi /etc/hosts
# Host Database
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##  localhost tile  broadcasthost
::1             localhost
fe80::1%lo0  localhost

Finally, you can see tiles like this.


Run as Tile generator Server

To make it working as tile generator server you need to load OSM database into PostGIS/PostgreSQL DBMS. You can use prepared load script for it.

local% vagrant ssh
local% cd /vagrant
local% test/

It loads Taiwan data for test(because size is relatively small and good for test purpose) It takes 10min or 1 hours for loading depending on your platform performance. (If you want to load japan data, it takes several hours, loading world takes several days)