Matomo 6.0: Self-Host a Privacy-First Google Analytics Alternative with Docker Compose

Matomo 6.0.0 is the first major release since 2023: PHP 8.1 and MySQL 8 as the new floor, spam filtering built into core, and auth tokens that can finally be read-only. Here is a pinned Docker Compose setup we tested end to end on a 1.8 GB Ubuntu VM, plus the wizard steps that trip people up.

Share
Matomo 6 Visitors Overview report with a visits-over-time chart and KPI cards
Matomo 6.0.0 running on our test VM (demo data). Screenshot: uptime.bet

Matomo has been the obvious answer to "I want analytics, but I don't want to hand my visitors to Google" for well over a decade. What it hasn't had in a while is a major release. That changed on 23 November 2026, when Matomo 6.0.0 landed as the first major version since December 2023.

Version 6 is less about flashy new reports and more about clearing out the attic: PHP 8.1 as the new floor, MySQL 8 or MariaDB 10.6 as the database floor, a rebuilt front-end toolchain, and spam filtering folded into the core instead of living in a separate plugin. There are a couple of genuinely useful additions too, in particular auth tokens that can finally be read-only.

We ran the whole thing on a fresh Ubuntu 24.04 VM with 2 vCPU and 1.8 GB of RAM to see how it behaves on the kind of box most people actually have lying around. Below is the Docker Compose setup we tested, the parts of the wizard that tripped us up, and an honest look at what Matomo costs you in resources and attention.

What Matomo does

Matomo is a full web analytics platform you run yourself. You drop a JavaScript snippet on your site (or feed it server logs, or call the HTTP tracking API directly), and it records visits, page views, referrers, devices, campaigns and goals into your own MySQL or MariaDB database. Nothing leaves your server.

The reporting side is the part that surprises people coming from the lightweight alternatives. Out of the box you get visitor and real-time maps, page and entry/exit reports, transitions, acquisition channels broken down by search engine, social network and campaign, goal and e-commerce tracking, segments, scheduled e-mail reports, and a reporting API that returns JSON, XML, CSV or TSV. Tag Manager ships alongside it.

Matomo 6 Acquisition report showing channel types and referrers
Acquisition reporting in Matomo 6.0.0 on our test VM (demo data). Screenshot: uptime.bet

Some of the headline features in the sidebar — Heatmaps, Session Recordings, Funnels, A/B Tests, Custom Reports — are paid plugins from the Matomo Marketplace. They show up in the menu of a free install and lead to a purchase page. That is worth knowing before you promise a colleague a heatmap.

What's new in 6.0

The release notes are long, so here are the changes that matter for a self-hosted install:

  • New system requirements. PHP 8.1 or newer, and MySQL 8.0 or MariaDB 10.6. Matomo now checks the actual database server type and no longer supports the experimental TiDB schema.
  • Spam and bot filtering is built in. Tracking Spam Prevention used to be a separate plugin; it is now part of core, enabled by default, and cannot be uninstalled.
  • Auth tokens have their own access level. A token no longer automatically inherits everything its owner can do — you pick View, Write, Admin or Superuser when you create it.
  • Percentage columns everywhere. Every metric in an API response now has a matching …_percent_of_total column, and scheduled reports include percentage-of-total columns in HTML, PDF, CSV and TSV.
  • Database changes on upgrade. A consent column is added to log_visit and a new log_page_view_time table is created. On a large visits log that ALTER TABLE is the slow part of the upgrade, so plan a window if you are updating an existing instance.
  • The SEO plugin is gone, along with the SEO.getRank API method.
  • Visitor maps were redrawn with current geographic data, and dropdowns, search fields and report headers were standardised.

If you are coming from Matomo 5, read the requirements section of the changelog before you touch anything. Instances behind a reverse proxy that use proxy_host_headers need both the public hostname and the hostname used to reach Matomo listed in trusted_hosts, or the upgrade will lock you out.

Before you start

You need a host with Docker and the Compose plugin, a domain pointed at it, and a reverse proxy terminating TLS. We use example.com throughout — swap in your own.

On resources: our 1.8 GB test VM was comfortable. Right after startup the two containers sat at roughly 148 MiB (Matomo) and 135 MiB (MariaDB). While clicking through reports with a couple of weeks of demo data loaded, Matomo peaked around 242 MiB and MariaDB dropped to about 106 MiB. Call it 350 MiB in practice for a small site. The images are not small, though: matomo:6.0.0-apache is about 875 MB on disk and mariadb:12.3.4 about 466 MB.

That number will grow with your traffic. Matomo's archiving step is what turns raw visits into reports, and on a busy site it is the thing that eats CPU and memory. More on that below.

1. Create the project directory

mkdir -p /opt/matomo && cd /opt/matomo

2. Generate the database passwords

Write them straight into a .env file so they never end up in your shell history or in the Compose file:

umask 077
printf 'MARIADB_PASSWORD=%s\nMARIADB_ROOT_PASSWORD=%s\n' \
  "$(openssl rand -base64 24 | tr -d '/+=')" \
  "$(openssl rand -base64 24 | tr -d '/+=')" > .env

3. Write the Compose file

This is adapted from the official Apache example in the matomo-org/docker repository, with the image tags pinned instead of floating on matomo and mariadb:lts. Pinning matters here: Matomo 6 is a major upgrade with a schema migration, and you do not want that to happen because a docker compose pull ran at the wrong moment.

services:
  db:
    image: mariadb:12.3.4
    command: --max-allowed-packet=64MB
    restart: unless-stopped
    volumes:
      - db:/var/lib/mysql
    environment:
      - MARIADB_AUTO_UPGRADE=1
      - MARIADB_DATABASE=matomo
      - MARIADB_DISABLE_UPGRADE_BACKUP=1
      - MARIADB_INITDB_SKIP_TZINFO=1
      - MARIADB_USER=matomo
      - MARIADB_PASSWORD=${MARIADB_PASSWORD}
      - MARIADB_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD}

  app:
    image: matomo:6.0.0-apache
    restart: unless-stopped
    depends_on:
      - db
    volumes:
      - matomo:/var/www/html
    environment:
      - MATOMO_DATABASE_ADAPTER=mysql
      - MATOMO_DATABASE_HOST=db
      - MATOMO_DATABASE_DBNAME=matomo
      - MATOMO_DATABASE_TABLES_PREFIX=matomo_
      - MATOMO_DATABASE_USERNAME=matomo
      - MATOMO_DATABASE_PASSWORD=${MARIADB_PASSWORD}
      - PHP_MEMORY_LIMIT=512M
    ports:
      - "8080:80"

volumes:
  db:
  matomo:

A few notes on the choices above. mariadb:12.3.4 is what mariadb:lts resolved to on the day we wrote this, verified by comparing image digests on Docker Hub; any MariaDB from 10.6 upwards satisfies Matomo 6. The six MATOMO_DATABASE_* variables and PHP_MEMORY_LIMIT are the ones the official image documents, and they are the only ones we used. The whole Matomo web root lives in the matomo volume, which is also where plugins and your config/config.ini.php end up, so back that volume up alongside the database.

If your reverse proxy runs on the same host, bind the port to loopback with "127.0.0.1:8080:80" instead. That is the only change we made for our own test run.

4. Start it

docker compose up -d

On our VM, pulling both images and reaching a healthy state took well under a minute. Matomo's own healthcheck means docker compose up -d --wait actually tells you something useful here.

Finishing the setup in the browser

Point your proxy at port 8080 and open https://example.com. You get an eight-step wizard: Welcome, System Check, Database Setup, Creating the Tables, Superuser, Set up a Website, JavaScript Tracking Code, Congratulations.

The database step is already filled in from the environment variables — server db, login matomo, database matomo, prefix matomo_ — so you just click through it.

Matomo 6 installation wizard, Database Setup step with fields pre-filled
The Database Setup step reads its values from the Compose environment. Matomo 6.0.0 on our test VM. Screenshot: uptime.bet

Four things caught us out, all of them small but all of them real:

  • The timezone dropdown has no default. It starts on "No timezone", and if you leave it there the "Set up a Website" form just re-renders itself without an obvious error. Pick a city before you click Next.
  • The installation is not finished until you press "Continue to Matomo" on the last step. Until you do, installation_in_progress = 1 stays in config/config.ini.php and any visit to the site drops you back into the wizard at 0%. We found this out the hard way.
  • You have to sign in again immediately afterwards. The wizard session does not carry over into the app.
  • trusted_hosts is pinned to whatever host you used first. Matomo writes it into config.ini.php during setup. If you install through a temporary address and move to your real domain later, you will have to edit that file by hand.

The last step also offers to "automatically configure geolocation using a dbip database", ticked by default. It downloads an external database from DB-IP under its own licensing terms, so untick it if you would rather not pull a third-party dataset onto your server.

Three things to do after installation

Move archiving to cron

This is the single change that matters most. By default Matomo processes reports when someone loads them in the browser, which gets slow fast. The system check flags it, and it was the only warning our otherwise clean install produced.

Run the archiver from the host crontab:

docker compose exec -u www-data app ./console core:archive --url=https://example.com/

On our test data — 110 visits over two weeks — that processed 17 archives in 3.6 seconds. Schedule it hourly and then turn off browser-triggered archiving in Administration → System → General settings.

Create a read-only token for anything that reads your data

This is the Matomo 6 feature we are happiest about. Under Administration → Personal → Security → Auth tokens, a new token now gets an explicit access level rather than inheriting your superuser rights. If you are pulling numbers into a dashboard, a status page or a script, give that token View access and nothing more.

Matomo 6 auth token form showing the new Token access level dropdown
Auth tokens in Matomo 6.0.0 get their own access level and an expiry date. Screenshot: uptime.bet

Token expiry is on by default with a 180-day lifetime, and "Only allow secure requests" is ticked, which means the token works in POST requests but not as a URL parameter. Leave both alone unless you specifically need a URL-usable token for embedded widgets.

Check what the spam filter is actually doing

Tracking Spam Prevention runs by default in Matomo 6 and filters known spammers and bot traffic, including headless-browser traffic generated by AI tools. It is not a blanket block on everything non-human, and it does not inspect your server logs — it filters incoming tracking requests. When we fed our test instance 316 page views through the HTTP tracking API using ordinary desktop and mobile browser user agents, all 316 were recorded. Treat it as a useful default, not as a guarantee that your numbers are bot-free.

Limits and security, honestly

Matomo is a PHP application with a relational database behind it, and it behaves like one. The things to go in with your eyes open about:

It is not lightweight. Roughly 1.3 GB of images and 350 MiB of RAM at rest for a near-idle install is fine on a VPS but noticeable on a Pi. Archiving load scales with traffic, not with the number of reports you look at.

Upgrades touch the schema. The 6.0 upgrade alters log_visit and creates a new table. Snapshot the database volume before you move a tag, and do not let latest make that decision for you.

Put it behind TLS and keep it there. Analytics data is visitor data. Matomo's own one-click updater now refuses to fall back to plain HTTP, and trusted_hosts exists precisely because host-header spoofing is a real attack against this kind of app.

The database is the backup. A Matomo backup means the MariaDB volume plus the matomo volume (config, plugins, custom logo). Backing up only one of them will not get you back.

Part of the sidebar is a paid upsell. Heatmaps, Session Recordings, Funnels, A/B Tests, Custom Reports, Form Analytics, Crash Analytics and Media Analytics are all premium plugins from the Matomo Marketplace, and they all appear in the menu of a free install. Nothing dishonest about it, but it does make the free product look more complete than it is at first glance.

How it compares

If all you want is a visit counter and a top-pages list, Matomo is more machine than you need. Plausible's community edition (AGPL-3.0) and Umami (MIT) both do cookieless, single-purpose analytics with far smaller footprints and much simpler dashboards, and both install from a Compose file in about the same time.

Matomo earns its weight when you need the things those two deliberately leave out: segments, goals and e-commerce, campaign attribution, server log import, a full reporting API, multi-site management with per-user permissions, and Tag Manager in the same install. It is also the only one of the three that has been around long enough to have a plugin ecosystem worth the name.

Against Google Analytics the trade is the obvious one. You give up the free hosting and the integration with the rest of Google's stack, and you get unsampled data, no data sharing, and a database you can query yourself.

Verdict

Matomo 6.0 is a maintenance release wearing a major version number, and that is meant as a compliment. Dropping old PHP and MySQL versions, pulling spam filtering into core and giving tokens their own permissions are exactly the changes a fifteen-year-old codebase needs.

The Docker Compose setup is genuinely boring in the good way — two containers, two volumes, seven environment variables, and the wizard reads most of its answers from Compose. Budget twenty minutes for the install, another ten to get cron archiving working, and keep a backup habit for both volumes. If you already run Matomo 5, read the requirements section of the changelog first and snapshot your database before you move the tag.

Sources

Tested on a fresh Ubuntu 24.04 VM (2 vCPU, 1.8 GB RAM, no GPU) on 1 December 2026 with Matomo 6.0.0 (PHP 8.4.28, Apache 2.4.71) and MariaDB 12.3.4. All screenshots show demo data.