Skip to content

Set Up Umami on a Linux Server – Lightweight Cookie-Free Web Analytics

Umami on a Linux server: as a One-Click App with a generated admin password or with Docker Compose, plus tracking code, HTTPS, 2FA and backups.

2 December 202614 min read1 Views0 helpful

Introduction

Umami is lightweight web analytics that you host yourself. A small script on your website sends page views, referrers, browsers, devices, and approximate locations to your own server. The dashboard shows visitors, page views, visit duration, bounce rate, and your most popular pages, as well as events such as button clicks. Umami doesn’t use cookies and stores data in a PostgreSQL database on your server, not with a third-party provider.

In this guide, we’ll show you two ways to install it: the easy way using the One-Click App, which gets Umami running over HTTPS in just a few minutes, and a manual installation with Docker Compose. Then you’ll add your first website, insert the tracking code, and check that the data is coming through.

When Umami Makes Sense on a VPS

Umami is a good fit if you want to understand how your website is used without handing your data to a third party. It’s worth using on a VPS if:

  • You want to analyze multiple websites, such as your blog, shop, and game server website. A single Umami instance can track any number of websites.
  • You want to keep the data to yourself. Raw data and reports stay in your own database.
  • You want to avoid cookies. The script doesn’t use cookies and works with anonymous identifiers that change regularly.
  • The most important metrics are enough for you, rather than a full marketing tool. The dashboard stays clear and loads quickly.
  • You’re looking for a lightweight tool. On our test VPS, Umami and PostgreSQL together used just under 300 MB of RAM at idle.

Umami is less suitable if you want to link ad campaigns to accounts on ad networks or track individuals across multiple devices. If you want to import old data from Google Analytics or need a wide range of extensions, Matomo is a better choice.

Umami, Plausible, or Matomo?

You can host all three tools on a VPS. Their main differences are how much they offer:

UmamiPlausibleMatomo
FocusLightweight web analytics with events, funnels, and teamsLightweight web analytics with a very simple dashboardComprehensive web analytics, similar to Google Analytics
CookiesNoneNoneOptional, can be disabled
DatabasePostgreSQLPostgreSQL and ClickHouseMariaDB or MySQL
ResourcesLowMediumMedium to high
GuideThis pageSet up PlausibleSet up Matomo

For one website or a few projects with moderate traffic, Umami is the most lightweight option.

The Easy Way: Umami as a One-Click App

The quickest way to get Umami running is through your VPS’s One-Click Apps. The app includes a PostgreSQL database and is available directly over HTTPS when you set a domain. You don’t need to configure a reverse proxy, certificate, or firewall rules.

Requirements

  • A Linux VPS (Debian or Ubuntu) with One-Click Apps set up. For instructions, see Set up One-Click Apps.
  • Plan for at least 512 MB of RAM for Umami and PostgreSQL; 1 GB is recommended. The two images take up around 1.8 GB, plus the database, which grows with every page view it collects.

Install

  1. Open your VPS in the ZapX dashboard and go to the One-Click Apps tab.
  2. Search the app catalog for Umami and click Install app.
  3. Use a custom subdomain or zap.cloud is already selected, with a random name. Leave it enabled and enter a custom name if needed, such as stats or analytics. A domain is required for Umami; see “Why Umami Needs a Domain with HTTPS.”
  4. Under App configuration, there’s only one optional field, POSTGRES_DB, for the database name. Leave the default value, umami, as is. The panel automatically generates the database username and password, the secret key for logins (SERVICE_PASSWORD_64_UMAMI), and your admin password (SERVICE_PASSWORD_UMAMI).
  5. Click Queue installation.

After a few minutes, the app card will show Online. On its first start, Umami creates the database tables. The installation then replaces the default password for the admin account with the generated password.

First Login

  1. Click the gear icon on the app card and open the App environment tab. Your password is listed under Automatically generated values as SERVICE_PASSWORD_UMAMI. Click the eye icon to reveal it, or the icon next to it to copy it.
  2. Open Umami using the Access link on the app card. You’ll land on the login page.
  3. Enter admin for Username and the generated password for Password, then click Login.

Umami’s publicly known default login (admin with the password umami) is no longer available with the One-Click App once the app is Online. You don’t need the other generated values to log in.

Info: The password is only valid for the first start

SERVICE_PASSWORD_UMAMI is set only once, while the account still has the default password. If you change your password in Umami, App environment will continue to show the old value. Make sure to save your new password in your password manager.

Set a Custom Password and Add More Accounts

The generated password is long and random, so you can keep it. To set your own password:

  1. Click admin in the bottom left, then click Settings.
  2. Go to Security and click Change password.
  3. Enter your current password and your new password twice, then save.

Create individual accounts for other people instead of sharing your admin account. See “Users and Teams.”

Enable Two-Factor Authentication

Umami can also ask for a code from an authenticator app when you log in. Umami needs its own key for this, which the One-Click App doesn’t create automatically. Without it, Two-factor authentication under Security will show Not configured, along with a note that TWO_FACTOR_ENCRYPTION_KEY is missing. Here’s how to add it:

  1. Use SSH on the VPS or your PC to generate a key with 64 hexadecimal characters by running openssl rand -hex 32.
  2. Click the gear icon on the app card and open the App environment tab. Under Custom environment variables, click the plus icon, enter TWO_FACTOR_ENCRYPTION_KEY under Key and the generated key under Value, then click Save. The app will restart.
  3. Log in to Umami again and go to admin > Settings > Security, then select Enable 2FA. Scan the QR code with your authenticator app, confirm with the code, and store the backup codes somewhere safe.
Warning: Don’t change the key later

Umami uses this key to encrypt the 2FA data for all accounts. If you change or delete it later, two-factor authentication will stop working and everyone will need to set it up again. Make sure to store the key in your password manager as well.

Why Umami Needs a Domain with HTTPS

Tracking runs in your visitors’ browsers: your website loads the script.js script from your Umami address and sends every page view to /api/send on the same server. This means:

  • Umami must be publicly accessible. Access through an SSH tunnel or from your home network is enough for the dashboard, but not for tracking.
  • Umami must be available over HTTPS. If your website uses HTTPS, browsers block scripts loaded over HTTP. Without a domain, the app would only be available over HTTP, so leave Use a custom subdomain or zap.cloud enabled during installation.
  • The address should stay the same. It’s included in the tracking code on every website. If you change the domain later under App actions, you’ll need to update the code on all your websites. If you want to use a custom domain such as stats.example.com, set it up during installation.

The script and data collection endpoint are intentionally accessible without a login. They only accept data for websites set up in your Umami instance. Your dashboard itself is protected by your password.

Updates and Backups

To update Umami, open the app settings (gear icon) and go to App update. Click Check for updates and install a new version with Apply update. If it says the app is up to date, there isn’t a newer version in the app catalog yet. Umami applies any necessary database changes when it starts.

Websites, accounts, and all collected data are stored in the PostgreSQL database in the app’s data volume and are preserved during updates. Back up the entire VPS using Backups in the dashboard. To back up only the Umami database, connect over SSH. First, find the name of the database container:

Code
docker ps --format '{{.Names}}' | grep -e '^umami-' -e '^postgresql-'

The Umami container is named umami-<ID>, and the database container next to it is postgresql-<ID> with the same ID. Run this command to create a database export:

Code
docker exec postgresql-ID sh -c 'pg_dump -U "$POSTGRES_USER" "$POSTGRES_DB"' > umami-$(date +%F).sql

Replace postgresql-ID with the name from the list. The command reads the username and database name directly from the container, so you don’t need to enter them manually.

Manual Installation

The rest of this guide covers a manual installation of Umami with Docker Compose on your VPS—for example, if you don’t use One-Click Apps on the server or want to run Umami behind your own reverse proxy. We use the same images as the One-Click App.

Requirements

  • A Linux VPS running Debian or Ubuntu, with SSH access. See First SSH connection.
  • Docker and Docker Compose (Compose v2). See Install Docker. Check the installation with docker --version and docker compose version.
  • A domain or subdomain whose A record points to your VPS’s IP address (e.g., stats.example.com). Tracking won’t work without a domain with HTTPS.

The figures below apply to Umami and PostgreSQL together. If you run other services on the server, add their resource requirements as well.

HardwareMinimumRecommended
CPU1 vCPU core2 vCPU cores
RAM512 MB1 GB
Storage5 GB10 GB

Configure the Firewall

Umami listens on port 3000 inside the container. In this guide, you’ll access Umami only through a reverse proxy, and the database will remain entirely within the internal Docker network. With ufw, allow only SSH and the ports used by the reverse proxy:

Code
ufw allow OpenSSH
ufw allow 80/tcp
ufw allow 443/tcp
ufw enable
Warning: Docker bypasses ufw

Ports exposed by Docker with ports: are accessible from outside, even if ufw blocks them. Docker adds its own rules before the ufw rules. For this reason, bind Umami to 127.0.0.1 as shown below. For more information about the firewall, see Managing the Firewall on Linux.

Install with Docker Compose

Create a directory for Umami:

Code
mkdir -p /opt/umami
cd /opt/umami

Umami needs three secret values: a database password, a key for logins (APP_SECRET), and a key for two-factor authentication (TWO_FACTOR_ENCRYPTION_KEY). Generate them directly into the .env file:

Code
echo "DB_PASSWORD=$(openssl rand -hex 24)" > .env
echo "APP_SECRET=$(openssl rand -hex 32)" >> .env
echo "TWO_FACTOR_ENCRYPTION_KEY=$(openssl rand -hex 32)" >> .env
chmod 600 .env

This creates a database password containing only numbers and letters. You’d need to escape special characters in the connection URL below. Next, create the docker-compose.yml file (nano docker-compose.yml) and add this content:

Code
services:
  umami:
    image: ghcr.io/umami-software/umami:3.5.0
    container_name: umami
    restart: unless-stopped
    environment:
      DATABASE_URL: postgresql://umami:${DB_PASSWORD}@db:5432/umami
      APP_SECRET: ${APP_SECRET}
      TWO_FACTOR_ENCRYPTION_KEY: ${TWO_FACTOR_ENCRYPTION_KEY}
    ports:
      - "127.0.0.1:3000:3000"
    depends_on:
      db:
        condition: service_healthy
    init: true
    healthcheck:
      test: ["CMD-SHELL", "curl -f http://localhost:3000/api/heartbeat"]
      interval: 5s
      timeout: 5s
      retries: 5

  db:
    image: postgres:16-alpine
    container_name: umami-db
    restart: unless-stopped
    environment:
      POSTGRES_DB: umami
      POSTGRES_USER: umami
      POSTGRES_PASSWORD: ${DB_PASSWORD}
    volumes:
      - ./db:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U umami -d umami"]
      interval: 5s
      timeout: 5s
      retries: 5

Here’s what the important lines do:

  • image: Umami and PostgreSQL at fixed versions, so you can decide when to update them.
  • DATABASE_URL: the database connection. The username, password, and database name must match the POSTGRES_* values for the db service.
  • APP_SECRET: signs logins and is used to generate anonymous visitor identifiers. Since version 3.5.0, Umami won’t start without this value. Don’t change it later, or everyone will be logged out and returning visitors will briefly be counted as new.
  • TWO_FACTOR_ENCRYPTION_KEY: encrypts two-factor authentication data. Without it, no one can enable 2FA. If it’s lost, everyone will need to set up 2FA again.
  • ./db:/var/lib/postgresql/data: this is where the database stores all websites, accounts, and statistics. You’ll back up this directory later.
  • healthcheck and depends_on: Umami only starts once the database is accepting connections. Umami then creates its tables on the first start.
  • 127.0.0.1:3000:3000: Umami is only accessible from the server itself, and from outside only through the reverse proxy. The database doesn’t expose a port.

Pull the images and start both containers:

Code
docker compose pull
docker compose up -d
docker compose ps

Umami is ready once docker compose ps shows the umami service as healthy.

First Visit

On the first start, Umami creates the admin account with the password umami. These credentials are listed in the official documentation and are publicly known. So log in through an SSH tunnel first, before Umami is accessible from outside. Run this command on your own PC:

Code
ssh -L 3000:127.0.0.1:3000 root@SERVER_IP

Then visit http://localhost:3000 in your browser and log in with admin and umami. The first time you log in with the default password, Umami requires you to set a new password immediately. Choose a long, unique password. Only then should you make Umami publicly accessible through the reverse proxy.

Access Umami over HTTPS Through a Reverse Proxy

Set up a reverse proxy with a valid certificate in front of Umami for the dashboard and, especially, for tracking. For the basics, see Set up an nginx reverse proxy and Create an SSL certificate (Let’s Encrypt). Here’s a server block for nginx:

Code
server {
    listen 80;
    server_name stats.example.com;

    location / {
        proxy_pass http://127.0.0.1:3000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
    }
}

Then get the certificate with certbot --nginx -d stats.example.com. Certbot adds HTTPS and redirects HTTP to the block. The X-Real-IP and X-Forwarded-For lines pass visitors’ IP addresses to Umami. Without them, Umami sees only the proxy’s address and can’t distinguish locations or individual visitors. Umami doesn’t store the IP address itself.

Find more tips for securing your server in Linux security tips.

Back Up Your Data

All Umami data is stored in PostgreSQL. You can create an export while it’s running:

Code
cd /opt/umami
docker compose exec -T db pg_dump -U umami umami > umami-$(date +%F).sql

Don’t store the export and .env file only on the VPS itself. Without APP_SECRET and TWO_FACTOR_ENCRYPTION_KEY from .env, logins and 2FA won’t work as before after a restore. You can import the export into an empty database:

Code
docker compose exec -T db psql -U umami umami < umami-2026-01-01.sql

Update Umami

Back up your data first, as described above. Then set the new version for the umami image in docker-compose.yml and restart:

Code
cd /opt/umami
docker compose pull
docker compose up -d
docker image prune

Available versions and their notes are listed on the Umami release page. Umami applies any necessary database changes when it starts. If you’re upgrading across multiple versions, read the update notes first. docker image prune then removes the old images. You can update the postgres:16-alpine image within version 16 in the same way. Only switch to a new major version of PostgreSQL using an export and import.

Analyze Websites with Umami

Once setup is complete, add your websites and insert the tracking code.

Add a Website and Insert the Tracking Code

  1. In Umami, click Websites on the left, then click Add website.
  2. Enter any name under Name and your website’s domain under Domain, without https://, for example, example.com. Click Save.
  3. Open the website’s settings. Under Tracking code, you’ll find the complete code with your Umami address and the Website ID.
  4. Copy the code and add it to the <head> section on every page of your website.

The code looks like this:

Code
<script defer src="https://stats.example.com/script.js" data-website-id="DEINE-WEBSITE-ID"></script>

For WordPress, add the code through your theme or a plugin for custom header scripts. Many website builders have a field for custom code in the header. Then visit your website. The visit will appear on the website dashboard within a few seconds; you can see it live under Realtime. If no data comes through, open your browser’s developer tools (F12) and check the network tab to see whether script.js and /api/send load without errors.

Exclude Your Own Visits and Test Environments

Your own visits can quickly skew the numbers on small websites. Open the developer tools console on your website and enter:

Code
localStorage.setItem('umami.disabled', 1);

This applies to this browser and this website. To be counted again, run localStorage.removeItem('umami.disabled');. If the same code runs in a test or development environment, use the data-domains attribute to limit tracking to your actual domains:

Code
<script defer src="https://stats.example.com/script.js" data-website-id="DEINE-WEBSITE-ID" data-domains="example.com,www.example.com"></script>

Track Clicks and Events

In addition to page views, Umami tracks events. The easiest way is to add an attribute to buttons or links:

Code
<a href="/shop" data-umami-event="Shop-Button">Zum Shop</a>

Each click will then appear under Events with the name Shop-Button. Names can be up to 50 characters long. Use Goals and Funnels to turn multiple events into goals and funnels, such as tracking the journey from a visit to the homepage to an order.

Users and Teams

As an admin, you can create additional accounts by clicking admin in the bottom left, then Admin. Under Users, click Create user to create an account and choose a role:

  • Admin: can do everything, including managing accounts and instance settings.
  • User: can manage their own websites but can’t access the admin area.
  • View Only: can only view analytics.

If several people need to see the same websites, go to Settings > Teams, click Create team, and transfer the websites to the team. To show analytics without a login, for example to a customer, create a public link under Share in the website settings and choose which views to make visible.

Ad Blockers

Some ad blockers block well-known analytics scripts, including Umami. As a result, visitors using these blockers won’t be included in your numbers. You can use two environment variables to give the script and endpoint neutral names:

VariableEffectExample
TRACKER_SCRIPT_NAMEChanges the name of script.jss.js
COLLECT_API_ENDPOINTChanges the path of /api/send/api/s

For the One-Click App, add these under Custom environment variables in the app settings (gear icon) > App environment, as described above for the 2FA key, then click Save. For a manual installation, add them to the environment section of the umami service and restart with docker compose up -d. Then update the filename in your websites’ tracking code; the endpoint is updated automatically.

Limitations

  • No personal profiles: Umami recognizes visitors only anonymously and for a limited time. A visitor using multiple devices is counted more than once.
  • No imports: Umami doesn’t import data from Google Analytics or other tools. Statistics start when you add the tracking code.
  • Data is kept indefinitely: When self-hosted, Umami doesn’t delete anything automatically. If needed, remove old data for a website using Reset website in its settings.
  • You’re still responsible for legal requirements: Umami doesn’t use cookies. Whether your website still needs a notice in its privacy policy or a banner depends on all the services you use and isn’t determined by the software.

Conclusion

With Umami, you now have lightweight web analytics on your own server that works without cookies and tracks as many websites as you like. To go with it, the guide Set Up Uptime Kuma on a Linux Server shows you how to monitor the availability of these websites yourself.

If you have any other questions or need help, our support team is available every day! 🙂

Free tools

Related tools for servers and developers

View all

FAQ

Frequently asked questions

The One-Click App is the faster option: Umami is available over HTTPS within minutes, the database is included, and the admin password is generated automatically. Manual installation with Docker Compose makes sense if you don’t use One-Click Apps on your server, want to run Umami behind your own reverse proxy, or want to configure every setting yourself.
The username is admin. Find the password in the app settings (gear icon) under App environment as SERVICE_PASSWORD_UMAMI. The installation replaces the default login, admin with the password umami, on first start, so it won’t work with the One-Click App.
First, check that the tracking code is in the <head> section of every page and that Umami is available over HTTPS using a domain. Browsers block scripts loaded over HTTP on HTTPS pages. In your developer tools (F12), check the network tab to see whether script.js and /api/send load without errors. Other common causes include ad blockers, a data-domains attribute that doesn’t include your actual domain, or an incorrect Website ID.

Feedback

Was this article helpful?

Your feedback helps us prioritize and improve content.

0 of 0 people found this article helpful.

Personal support

Need more help than the guide provides?

Our ZAP-Hosting support team knows your product — briefly describe your issue and we'll help you personally.

Zappy knows this guide and answers you right in the chat.