Running your own map server can feel like a lot of moving parts. An openstreetmap tile server setup comes down to one stack: mod_tile, renderd, Mapnik, osm2pgsql and PostGIS, installed on Debian or Ubuntu and loaded with a small extract first.
If you are weighing up other ways to work with map data, our overview of street map tools puts this guide in context.
| Item | Value |
|---|---|
| Components in the stack | 5 main components |
| Debian 13 guide tested | August 2025, using OSM Carto v5.9.0 |
| Test data extract (Azerbaijan) | About 32Mb |
| Minimum carto compiler version | 1.2.0 or higher |
| Mapnik version the guide reports | Version 4.0.7 |
| VM hosting a Britain and Ireland map | 32GB RAM and 250GB SSD disk |
These figures come from the switch2osm Debian 13 guide and a server setup write-up on the OpenStreetMap wiki. Versions and requirements can change, so check the source before you rely on them.
What does the tile server stack contain?
The switch2osm guide lists 5 main components: mod_tile, renderd, Mapnik, osm2pgsql and a PostgreSQL/PostGIS database. As its Debian 13 page explains, this is the most standard version, similar to the one used on the main OpenStreetMap.org tile servers.
Each piece has a narrow job:
- mod_tile is an Apache module that serves cached tiles and decides which ones need re-rendering, either because they are not yet cached or because they are outdated (switch2osm).
- renderd queues requests by priority, which smooths out the load from rendering.
- Mapnik is the library that does the actual rendering for renderd.
- osm2pgsql fills the PostGIS database with map data before rendering starts, as the mod_tile wiki page describes.
- PostgreSQL/PostGIS holds the data that gets rendered.

The result is a raster tile server, meaning mod_tile serves PNG-style image tiles for a slippy map, as the OpenStreetMap wiki puts it. Because it renders on demand, only a small fraction of all tiles has to sit on disk, which reduces the resources you need.
openstretmap.org is an independent educational site and is not affiliated with the OpenStreetMap Foundation or the OpenStreetMap project. The step-by-step material summarised here belongs to switch2osm and the wiki authors, so follow their pages for the exact commands.
Preparing the server and the PostGIS database
The Debian 13 guide was written with OSM Carto v5.9.0 and tested in August 2025, according to switch2osm. The Ubuntu 24.04 edition (Noble Numbat) was tested in April 2024. Pick the one that matches your machine and expect package versions to have moved since those dates.
The preparation follows this order:
- Install the dependency packages with apt: the stack itself plus Apache, PostgreSQL, PostGIS, git and the carto tooling.
- On Debian, make sure your normal account can use sudo. The guide does this from root, then has you log out and back in.
- Note the two new accounts: postgres manages the databases, and _renderd runs the renderd daemon, so many later commands run as that user.
- Create a PostGIS database named gis, owned by _renderd, using createuser and createdb.
- Enable the postgis and hstore extensions inside that database, and hand ownership of the geometry_columns and spatial_ref_sys tables to _renderd.
- Check Mapnik with mapnik-render –version. The Debian 13 guide shows a reply of version 4.0.7.
The name gis is only a convention: the guide says various programs assume it by default, though using it is not required. Work from your regular account via sudo, because the guide warns that doing everything as root will not work.
Styling with OSM Carto and loading a first extract
The guide styles tiles with OpenStreetMap Carto, the style behind the standard map on openstreetmap.org. It is well documented and should work worldwide, but the guide admits it is a global compromise and quite complicated to modify (switch2osm).
The Debian 13 page pins release v5.9.0 with a git switch, because the latest OSM Carto has moved to a different database format. The old format is called pgsql and the new one flex, so osm2pgsql will warn you about it later (source).
Next, check that the carto compiler reports at least 1.2.0, then compile project.mml into a Mapnik XML file named mapnik.xml. That file is the stylesheet renderd will use, and the same guide gives the exact command.
Start with a small test extract rather than a continent. The guide downloads Azerbaijan from Geofabrik, which is about 32Mb, and tells you to note the file’s last-modified date for later updates (switch2osm).
Small areas also keep the wait short. A June 2017 diary post about an earlier edition of the guide said a from-scratch setup in the standard style should take just a few hours, with the shapefile downloads the longest wait for small areas (OpenStreetMap diary).
Serving tiles with renderd and mod_tile
Once mapnik.xml exists, renderd has to learn about it. A server setup write-up edits /etc/renderd.conf and adds one block per style, giving a URL path, the location of the mapnik.xml file, the host, the tile size and the maximum zoom.
On the zoom setting, 20 is the highest zoom value standard mod_tile accepts, according to the same write-up. Check that the basics work at that level before you try anything higher.
Apache then does the public-facing work. The mod_tile wiki page says its Apache module serves tiles and requests rendering when a tile is missing from the cache or has changed since it was cached.
When tiles load in a browser, you can point a web map at them. If hosting your own tiles turns out to be more than you need, our page on a free map api covers an alternative. And if what you actually want is paper, read how to print a street map instead.
Keeping data fresh and sizing the machine
A tile server shows a snapshot until you update it. That is why the Debian 13 guide has you record the extract’s date: you need it later if you want to update the database with people’s subsequent changes to OpenStreetMap (switch2osm).
Cache expiry works in two ways, as the mod_tile page explains. If the planet time stamp is updated, all tiles are marked dirty and re-rendered on the next visit. For diff-based updates, expiring everything would cost too much, so only the tiles whose data changed get expired.
For sizing, one real-world server gives a useful reference point. A VM with 32GB RAM and 250GB SSD disk comfortably hosts a Britain and Ireland map plus other uses, per the operator’s notes. Treat it as one example, not a minimum.
Frequently asked questions
Which operating system should I choose?
Show answer
Choose Debian or Ubuntu, whichever you already run, and follow the matching edition. One public setup write-up picked Debian because it is a long-term-support release and because the latest mod_tile and renderd arrive through a normal apt install, as the wiki notes say.
Why does the guide use an older OSM Carto release?
Show answer
The newer releases store data in the flex layout, while the older pgsql layout is what the walkthrough was built around. The switch2osm page says osm2pgsql prints a warning about the difference, and it sends you to OSM Carto’s own install notes for the newer route.
How much traffic can mod_tile handle?
Show answer
Its caching strategy allows high-performance serving and can support several thousand requests per second, according to the OpenStreetMap wiki. Your real ceiling still depends on your hardware.
Why do I see a “no datasource plugin” error when rendering?
Show answer
The Mapnik plugins directory varies between architectures. If the path in the [mapnik] section of renderd.conf is wrong or missing, rendering fails, so locate the real directory and correct the plugins_dir setting, as the setup notes describe.



