Quickly Set Up OpenStreetMap Tile Server On Ubuntu with OpenMapTiles

OpenStreetMap (OSM) is a user contributed world map that is freely editable. It’s an open-source and self-hosted alternative to Google Maps. Previously I wrote a step-by-step guide to installing your own OpenStreetMap tile server on Ubuntu. It’s a tedious task, I have to admit. Fortunately, there is a new open-source project that makes this process a breeze and In this tutorial I will show you how to quickly set up your own OpenStreeMap tiles server on Ubuntu 22.04/20.04.

Meet OpenMapTiles Map Server

OpenMapTiles Map Server provides 5 different views for the map:

  • OpenStreetMap
  • Contours
  • Hillshade
  • Satellite
  • Terrain

Maps are powered by the OpenStreetMap data and vector tiles from the OpenMapTiles project.


Please note that, to download the latest map data and get weekly updates from OpenMapTiles project, you need to purchase their production package, which starts at 1024USD.

Step 1: Set Up OpenStreetMap Tile Server On Ubuntu 22.04/20.04

Log into your Ubuntu 22.04/20.04 server and run the following command to install Docker.

curl -sSL https://get.docker.com/ | sh

Next, download the OpenMapTiles Docker image and run the docker container with the following command.

sudo docker run -d --rm -it -v $(pwd):/data -p 8080:80 klokantech/openmaptiles-server

This docker container will run in daemon mode and listens on localhost:8080. Now you need to visit the web-based wizard to finish installation. If this is a remote server, you need to set up a reverse proxy in order to access to web-based wizard.

Step 2: Set up Reverse Proxy

You can use Apache or Nginx to set up reverse proxy.


Apache is well-known web server that can also be used as a reverse proxy. Run the following command to install Apache on Ubuntu 22.04/20.04.

sudo apt install apache2

Start Apache and enable auto start.

sudo systemctl start apache2

sudo systemctl enable apache2

To use Apache as a reverse proxy, we need to enable the proxy modules and the header module.

sudo a2enmod proxy proxy_http headers proxy_wstunnel

Now create a virtual host file for OpenMapTiles Map Server.

sudo nano /etc/apache2/sites-available/openmaptiles.conf

Copy and paste the following lines in to the file. Replace osm.example.com with your real domain name. You should also add a DNS A record for this sub-domain.

<VirtualHost *:80>
   ServerName osm.example.com
   ErrorDocument 404 /404.html

   ProxyPreserveHost On
   ProxyPass / http://localhost:8080/
   ProxyPassReverse / http://localhost:8080/

   ErrorLog ${APACHE_LOG_DIR}/osm_error.log
   CustomLog ${APACHE_LOG_DIR}/osm_access.log combined


Save and close the file. Then enable this virtual host.

sudo a2ensite openmaptiles.conf

Restart Apache

sudo systemctl restart apache2

Now you can access the OpenMapTiles install wizard via osm.example.com.


Nginx becomes more and more popular these days as a web server and reverse proxy. Install Nginx on Ubuntu 22.04/20.04, 18.10 server with the following command.

sudo apt install nginx

Start Nginx and enable auto start.

sudo systemctl start nginx

sudo systemctl enable nginx

Now create a virtual host file for OpenMapTiles.

sudo nano /etc/nginx/conf.d/openmaptiles.conf

Copy and paste the following lines in to the file. Replace osm.example.com with your real domain name. You should also add a DNS A record for this sub-domain.

server {
  listen 80;
  server_name osm.example.com;

  access_log /var/log/nginx/osm_access.log;
  error_log /var/log/nginx/osm_error.log;
  location / {
     proxy_set_header Host $host;
     proxy_set_header X-Real-IP $remote_addr;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

Save and close this file. Then test Nginx configuations.

sudo nginx -t

If the test is successful, reload Nginx.

sudo systemctl reload nginx

Now in your browser’s address bar type in osm.example.com and you should be able to access the web-based install wizard.

Step 3: Enable HTTPS

To encrypt the HTTP traffic, we can enable HTTPS by installing a free TLS certificate issued from Let’s Encrypt. Run the following command to install Let’s Encrypt client (certbot) on Ubuntu 22.04/20.04 server.

sudo apt install certbot

If you use Apache, install the Certbot Apache plugin.

sudo apt install python3-certbot-apache

And run this command to obtain and install TLS certificate.

sudo certbot --apache --agree-tos --redirect --hsts --staple-ocsp --uir --email [email protected] -d osm.example.com

If you use Nginx, then you need to install the Certbot Nginx plugin.

sudo apt install python3-certbot-nginx

Next, run the following command to obtain and install TLS certificate.

sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email [email protected] -d osm.example.com


  • --nginx: Use the nginx plugin.
  • --apache: Use the Apache plugin.
  • --agree-tos: Agree to terms of service.
  • --redirect: Force HTTPS by 301 redirect.
  • --hsts: Add the Strict-Transport-Security header to every HTTP response. Forcing browser to always use TLS for the domain. Defends against SSL/TLS Stripping.
  • --staple-ocsp: Enables OCSP Stapling. A valid OCSP response is stapled to the certificate that the server offers during TLS.

The certificate should now be obtained and automatically installed.

openstreemap ubuntu 18.04

And you can access OpenMapTiles install wizard via HTTPS (https://osm.example.com).

Step 4: Finish Installation in the Web-based Wizard

First, click the start button.

OpenMapTiles Map Server install wizard

Next, you can select the map of the whole planet, or a continent, country, etc. Because we are using OpenMapTiles Map Server free edition, only a selected regions are available. Paid items are marked with a lock. I selected the whole planet, which is about 60GB in size.

openmaptiles production package

Then, you can select a style for your map. By default, all styles are selected.

osm ubuntu 18.04 install

In the next step, you can configure other settings. I just hit the save & run the server button.

osm vector and raster map tiles

In the last step, you need to sign in at OpenMapTiles.com and get the download key in order to download map data.

openmaptiles map data

If you want to serve the planet map, you can download an outdated map data for free, or purchase a production package (1024 USD) to download up-to-date map data with weekly updates.

openmaptiles Weekly updates for all regions and planet

Once the data are downloaded, your server with maps is going to be initialized.

openstreetmap tile server

And you can see the world map by selecting one of four available styles.

Quickly Set Up OpenStreetMap Tile Server On Ubuntu 18.04

How to Generate Your Own MBTiles

If you don’t want to pay for updated MBTiles, you can generate your own.


I hope this tutorial helped you set up OpenMapTiles Map server on Ubuntu 22.04/20.04 As always, if you found this post useful, then subscribe to our free newsletter to get more tips and tricks. Take care 🙂

Rate this tutorial
[Total: 6 Average: 4.8]

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community (https://community.linuxbabe.com) for questions unrelated to this article.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.

The maximum upload file size: 2 MB. You can upload: image. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here