Setting up a self-hosted Umami analytics instance involves several steps. Below is a general guide to help you get started. You will need a server with Docker and Docker Compose installed, as Umami uses these technologies for easy deployment.
Server Requirements:
A server running Ubuntu, Debian, or any Linux distribution.
Docker and Docker Compose installed on your server. You can install Docker with the following commands:
sudo apt update
sudo apt install -y docker.io docker-compose
Database:
Create a Project Directory:
mkdir umami
cd umami
Create a docker-compose.yml file:
Create a file named docker-compose.yml with the following content. This example uses PostgreSQL, but you can modify it to use MySQL if you prefer.
version: '3'
services:
db:
image: postgres:13
restart: always
environment:
POSTGRES_DB: umami
POSTGRES_USER: umami
POSTGRES_PASSWORD: your_password
volumes:
- db_data:/var/lib/postgresql/data
umami:
image: umami:latest
restart: always
environment:
DATABASE_URL: postgres://umami:your_password@db:5432/umami
APP_URL: http://your-domain-or-ip
ports:
- "3000:3000"
depends_on:
- db
volumes:
- umami_data:/var/lib/umami
volumes:
db_data:
umami_data:
Replace your_password with a secure password and http://your-domain-or-ip with your server’s domain name or IP address.
Start the Services:
Run the following command to start Umami and the database:
docker-compose up -d
This command runs the containers in detached mode.
Access Umami:
After the services are up and running, access Umami by navigating to http://your-domain-or-ip:3000 in your web browser.
Set Up Umami:
Add Tracking to Your Website:
<head> section of your website.