1,575
edits
Changes
Created page with "[https://www.openstreetmap.org/ Open Street Map] is a well know, open source (and crown sourced) alternative to the likes of [https://www.google.com/maps Google Maps] and [htt..."
[https://www.openstreetmap.org/ Open Street Map] is a well know, open source (and crown sourced) alternative to the likes of [https://www.google.com/maps Google Maps] and [https://www.bing.com/maps/ Bing Maps]. Open Street Maps content (ie: maps) are provided to users and applications by what are known as [https://wiki.openstreetmap.org/wiki/Tile_servers Tile Servers]. This tutorial will show you how to setup an Open Street Map Tile Server of your own in a [https://en.wikipedia.org/wiki/LXC Linux Container] running [https://ubuntu.com/ Ubuntu] 18.04 under [https://www.proxmox.com/en/ Proxmox]. Furthermore we'll use the built in and simple [https://wiki.openstreetmap.org/wiki/Slippy_Map Map Viewer]. This means that this container can provide map tiles to other applications (such as an ADS-B [[How to setup Virtual Radar Server and pingStation for offline use| Virtual Radar Server]]) as well as providing its own native Google Maps -like capability all while being totally disconnected from the internet.
=Install Prerequisites=
#Run ''sudo apt update''
#Run ''sudo apt upgrade''
#Run ''sudo dpkg-reconfigure locales''
#*select "en_US.UTF-8 UTF-8" on both screens
#Run ''sudo apt install software-properties-common''
#*hit '''Enter''' to continue
#Run ''sudo add-apt-repository ppa:osmadmins/ppa''
#Run ''sudo apt install postgresql postgresql-contrib postgis postgresql-10-postgis-2.4 osm2pgsql libapache2-mod-tile renderd curl unzip gdal-bin mapnik-utils libmapnik-dev nodejs npm ttf-dejavu fonts-noto-cjk fonts-noto-hinted fonts-noto-unhinted ttf-unifont''
#*choose '''Yes''' to "enable mod_tile in the apache config"
#Run ''sudo npm install -g carto''
#Run ''sudo -u postgres -i''
##Run ''createuser osm''
##Run ''createdb -E UTF8 -O osm gis''
##Run ''psql -c "CREATE EXTENSION postgis;" -d gis''
##Run ''psql -c "CREATE EXTENSION hstore;" -d gis''
##Run ''psql -c "ALTER TABLE spatial_ref_sys OWNER TO osm;" -d gis''
##Run ''exit''
#Run ''sudo adduser osm''
#Run ''su - osm''
##Run ''wget https://github.com/gravitystorm/openstreetmap-carto/archive/v4.21.1.tar.gz''
##Run ''tar xvf v*.tar.gz''
##Run ''wget -c http://download.geofabrik.de/north-america/us/georgia-latest.osm.pbf''
##*you can download the entire planet's PBF file [http://planet.openstreetmap.org/pbf/planet-latest.osm.pbf here] or select individual states and countries [http://download.geofabrik.de here].
#*At this point the [https://www.linuxbabe.com/ubuntu/openstreetmap-tile-server-ubuntu-18-04-osm standard Ubuntu 18.04 setup guide] I followed had you configure your machine's swap. Since Proxmox handles this we'll skip that step
##Run ''osm2pgsql --slim -d gis --hstore --multi-geometry --number-processes 2 --tag-transform-script /home/osm/openstreetmap-carto-4.21.1/openstreetmap-carto.lua --style /home/osm/openstreetmap-carto-4.21.1/openstreetmap-carto.style -C 3072 /home/osm/georgia-latest.osm.pbf''
##Run ''cd /home/osm/openstreetmap-carto-4.21.1''
##Run ''scripts/get-shapefiles.py''
##Run ''carto project.mml > style.xml''
#*You're going to see lots of Warnings. [https://github.com/gravitystorm/openstreetmap-carto/issues/3183 this is ok]. Your tile server will work fine.
##Run ''exit''
=CONTENT BELOW NEEDS TO BE FORMATTED=
sudo nano /etc/renderd.conf
[renderd]
set "num_threads=4" to the # of CPU Core's you have
[mapnik]
set "plugins_dir=/usr/lib/mapnik/3.0/input"
set "font_dir=/usr/share/fonts/truetype"
set "find_dir_recursive=true"
[default]
set "XML=/home/osm/openstreetmap-carto-4.21.1/style.xml"
set "HOST=YOURSERVER.COM"
sudo nano /etc/init.d/renderd
set "RUNASUSER=osm"
sudo chown osm:osm /var/lib/mod_tile/ -R
sudo systemctl daemon-reload
sudo systemctl restart renderd
sudo nano /etc/apache2/sites-available/tileserver_site.conf
set "ServeName YOURSERVER.COM"
comment out "ServerAlias a.tile.mytileserver.org b.tile.mytileserver.org c.tile.mytileserver.org" by prepending with a "#"
sudo nano /var/www/osm/slippymap.html
change "<title>" to what you want
change "var lat=", "var long=", & "var zoom=" to what you want
sudo rm /var/www/index.html
sudo nano /var/www/index.html and fill with
<html>
<head>
<meta http-equiv="refresh" content="0; url=http://YOURSERVER.COM/osm/slippymap.html" />
</head>
</html>
https://www.linuxbabe.com/ubuntu/openstreetmap-tile-server-ubuntu-18-04-osm
=Install Prerequisites=
#Run ''sudo apt update''
#Run ''sudo apt upgrade''
#Run ''sudo dpkg-reconfigure locales''
#*select "en_US.UTF-8 UTF-8" on both screens
#Run ''sudo apt install software-properties-common''
#*hit '''Enter''' to continue
#Run ''sudo add-apt-repository ppa:osmadmins/ppa''
#Run ''sudo apt install postgresql postgresql-contrib postgis postgresql-10-postgis-2.4 osm2pgsql libapache2-mod-tile renderd curl unzip gdal-bin mapnik-utils libmapnik-dev nodejs npm ttf-dejavu fonts-noto-cjk fonts-noto-hinted fonts-noto-unhinted ttf-unifont''
#*choose '''Yes''' to "enable mod_tile in the apache config"
#Run ''sudo npm install -g carto''
#Run ''sudo -u postgres -i''
##Run ''createuser osm''
##Run ''createdb -E UTF8 -O osm gis''
##Run ''psql -c "CREATE EXTENSION postgis;" -d gis''
##Run ''psql -c "CREATE EXTENSION hstore;" -d gis''
##Run ''psql -c "ALTER TABLE spatial_ref_sys OWNER TO osm;" -d gis''
##Run ''exit''
#Run ''sudo adduser osm''
#Run ''su - osm''
##Run ''wget https://github.com/gravitystorm/openstreetmap-carto/archive/v4.21.1.tar.gz''
##Run ''tar xvf v*.tar.gz''
##Run ''wget -c http://download.geofabrik.de/north-america/us/georgia-latest.osm.pbf''
##*you can download the entire planet's PBF file [http://planet.openstreetmap.org/pbf/planet-latest.osm.pbf here] or select individual states and countries [http://download.geofabrik.de here].
#*At this point the [https://www.linuxbabe.com/ubuntu/openstreetmap-tile-server-ubuntu-18-04-osm standard Ubuntu 18.04 setup guide] I followed had you configure your machine's swap. Since Proxmox handles this we'll skip that step
##Run ''osm2pgsql --slim -d gis --hstore --multi-geometry --number-processes 2 --tag-transform-script /home/osm/openstreetmap-carto-4.21.1/openstreetmap-carto.lua --style /home/osm/openstreetmap-carto-4.21.1/openstreetmap-carto.style -C 3072 /home/osm/georgia-latest.osm.pbf''
##Run ''cd /home/osm/openstreetmap-carto-4.21.1''
##Run ''scripts/get-shapefiles.py''
##Run ''carto project.mml > style.xml''
#*You're going to see lots of Warnings. [https://github.com/gravitystorm/openstreetmap-carto/issues/3183 this is ok]. Your tile server will work fine.
##Run ''exit''
=CONTENT BELOW NEEDS TO BE FORMATTED=
sudo nano /etc/renderd.conf
[renderd]
set "num_threads=4" to the # of CPU Core's you have
[mapnik]
set "plugins_dir=/usr/lib/mapnik/3.0/input"
set "font_dir=/usr/share/fonts/truetype"
set "find_dir_recursive=true"
[default]
set "XML=/home/osm/openstreetmap-carto-4.21.1/style.xml"
set "HOST=YOURSERVER.COM"
sudo nano /etc/init.d/renderd
set "RUNASUSER=osm"
sudo chown osm:osm /var/lib/mod_tile/ -R
sudo systemctl daemon-reload
sudo systemctl restart renderd
sudo nano /etc/apache2/sites-available/tileserver_site.conf
set "ServeName YOURSERVER.COM"
comment out "ServerAlias a.tile.mytileserver.org b.tile.mytileserver.org c.tile.mytileserver.org" by prepending with a "#"
sudo nano /var/www/osm/slippymap.html
change "<title>" to what you want
change "var lat=", "var long=", & "var zoom=" to what you want
sudo rm /var/www/index.html
sudo nano /var/www/index.html and fill with
<html>
<head>
<meta http-equiv="refresh" content="0; url=http://YOURSERVER.COM/osm/slippymap.html" />
</head>
</html>
https://www.linuxbabe.com/ubuntu/openstreetmap-tile-server-ubuntu-18-04-osm