EarthWyrm is an open-source map server developed for the Minnesota Department of Transportation (MnDOT). It can serve OpenStreetMap (and other) data in MVT format.
Install linux and dependencies (available from linux repositories):
Download OpenStreetMap data in .osm.pbf (OSM protobuf) format. See the OSM wiki for download options, such as Geofabrik.
Create database and import data
createdb earthwyrm
psql earthwyrm -c 'CREATE EXTENSION postgis'
time osm2pgsql -v --number-processes=8 -d earthwyrm --multi-geometry -s --drop ./[map-data].osm.pbf
Grant select permissions to public
psql earthwyrm
GRANT SELECT ON planet_osm_polygon TO PUBLIC;
GRANT SELECT ON planet_osm_line TO PUBLIC;
GRANT SELECT ON planet_osm_roads TO PUBLIC;
GRANT SELECT ON planet_osm_point TO PUBLIC;
\q
Configure PostgreSQL access for UNIX domain sockets
Edit /var/lib/pgsql/data/pghba.conf: change _local method to peer. Restart PostgreSQL server.
Build earthwyrm
git clone https://github.com/DougLau/earthwyrm.git
cd earthwyrm
cargo build --release
Install (as root)
cp target/release/earthwyrm /usr/local/bin/
sh ./examples/site/install.sh
Start the server
systemctl enable earthwyrm
systemctl start earthwyrm
systemctl status earthwyrm
By default, EarthWyrm will listen on the IPv4 loopback address. This means clients from other hosts will not be able to reach the server. There are a couple of options:
In either case, the url in /var/lib/earthwyrm/map.js will need to be updated.