Your OpenStreetMap server in 120GB

1. Install Ubuntu 14.04 server.
Remember to enable the firewall:
costales@maps:~$ sudo ufw allow http

costales@maps:~$ sudo ufw allow ssh

costales@maps:~$ sudo ufw enable

2. Check that you have all locales right:costales@maps:~$ localeIf some of them are empty, add them to /etc/environment, in my case LC_ALL & LANGUAGE:costales@maps:~$ cat /etc/environment

3. Install the server from a PPA:

sudo apt-get install software-properties-common

sudo add-apt-repository ppa:kakrueger/openstreetmap

sudo apt-get update

sudo apt-get install libapache2-mod-tile osmctools

4. Import a map: We’ll drop so many data for allow the smallest database, then space in hard disk 😉

4.1 Download from here in pbf. For example, europe-latest.osm.pbf:

costales@maps:~$ wget

4.2 Do it small, we’ll keep only the roads:

costales@maps:~$ osmconvert europe-latest.osm.pbf -o=europe.o5m

costales@maps:~$ osmfilter europe.o5m –drop-author –drop-version –keep=”highway=cycleway” –keep=”highway=path” –keep=”highway=footway” –keep=”highway=track” –keep=”highway=service” –keep=”highway=pedestrian” –keep=”highway=unclassified” –keep=”highway=residential” –keep=”highway=tertiary” –keep=”highway=secondary” –keep=”highway=primary” –keep=”highway=trunk” –keep=”highway=motorway” –keep=”highway=” –drop-tags=”alt_name” –drop-tags=”source” –drop-tags=”maxspeed” –drop-tags=”created_by” –drop-tags=”wheelchair*” -o=europe_tmp.o5m

costales@maps:~$ osmconvert europe_tmp.o5m -o=europe_end.pbf

costales@maps:~$ rm europe-latest.osm.pbf europe.o5m europe_tmp.o5m

4.3 Import it into the database:

costales@maps:~$ osm2pgsql –drop –slim -C 1700 –number-processes 2 europe_end.pbf

1700 is the GB of RAM and 2 the CPUs.

5. Set it as complete

Original URL:

Original article

Comments are closed.

Proudly powered by WordPress | Theme: Baskerville 2 by Anders Noren.

Up ↑

%d bloggers like this: