How to Self-Host Umami on a VPS (Complete Guide)
Umami is a self-hosted web analytics solution that prioritizes privacy and simplicity. This guide will take you through the process of self-hosting Umami on a Virtual Private Server (VPS) using Docker, providing a complete walkthrough for developers and homelab enthusiasts.
Prerequisites
Before diving in, ensure you have the following requirements:
- An active VPS from a reliable provider. Hereโs a comparison of popular options:
| Provider | Price/Month | Key Features |
|---|---|---|
| Contabo VPS | 5.99 EUR | High performance, robust SSD storage |
| Hetzner Cloud | 4.15 EUR | Flexible resource scaling, excellent support |
| DigitalOcean | 6 USD | Easy-to-use interface, fast deployment |
| Vultr | 6 USD | Multiple data center locations, quick setup |
| Linode | 5 USD | Good performance, straightforward billing |
For detailed comparisons, visit our full VPS comparison.
- Basic command-line knowledge.
- A domain name pointing to your VPS.
- Installed Docker and Docker Compose.
Step 1: Setting Up Your VPS
First, access your VPS via SSH. Replace username and vps_ip with your actual username and VPS IP address:
ssh username@vps_ip
Update your package index:
sudo apt update && sudo apt upgrade -y
Step 2: Install Docker
If Docker is not installed, follow these steps:
sudo apt install apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
sudo apt install docker-ce -y
Verify Docker installation:
sudo systemctl status docker
Step 3: Install Docker Compose
Docker Compose simplifies managing multi-container applications. Install it with:
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
Check your installation:
docker-compose --version
Step 4: Running Umami
Create a directory for Umami:
mkdir umami && cd umami
Create a docker-compose.yml file:
version: '3'
services:
umami:
image: umami/umami
restart: always
environment:
DATABASE_URL: postgres://umami:umami_password@db:5432/umami
NEXT_PUBLIC_USERNAME: admin
NEXT_PUBLIC_PASSWORD: admin_password
ports:
- "3000:3000"
db:
image: postgres
restart: always
environment:
POSTGRES_USER: umami
POSTGRES_DB: umami
POSTGRES_PASSWORD: umami_password
volumes:
- db_data:/var/lib/postgresql/data
networks:
- umami-network
volumes:
db_data:
networks:
umami-network:
Replace umami_password and admin_password with strong, unique passwords.
Step 5: Launch Umami
Run the following command to start Umami:
docker-compose up -d
Confirm all containers are running:
docker-compose ps
Step 6: Configure Umami
Access Umami by navigating to http://your_domain_or_vps_ip:3000 in your browser. Complete the setup by adding sites to monitor.
FAQs
How do I secure Umami with HTTPS?
To secure your Umami installation, you should set up a reverse proxy using Nginx or Traefik to handle HTTPS through Letโs Encrypt. Ensure your domain points to your server, then install the reverse proxy and configure SSL certificates following documentation for either Nginx or Traefik.
Can I monitor multiple websites with Umami?
Yes, Umami allows you to track multiple websites from the same dashboard. Simply log in, click on โAdd a new site,โ and follow the prompts to enter your siteโs URL and other relevant details. Once added, youโll be able to view analytics for each site separately from your Umami dashboard.
What are the system requirements for running Umami?
Umami does not have strict system requirements, but for a smooth experience, a VPS with at least 1 GB of RAM and 1 CPU core is recommended. More significant traffic levels may require additional resources, and using a SSD can substantially improve performance.
Conclusion
Self-hosting Umami on a VPS is a straightforward process that allows you to maintain control over your analytics data while enjoying the benefits of a powerful, open-source platform. With Docker, the setup is even more accessible and manageable. Now, youโre ready to analyze your websiteโs performance without compromising your privacy. Happy self-hosting!