Installing from Source
Installing Umami from source gives you complete control over the build process and allows you to customize the application. This method is recommended for developers or advanced users.Prerequisites
Node.js
Version 18.18 or higher required
PostgreSQL
Version 12.14 or higher required
pnpm
Package manager (installed via npm)
Git
For cloning the repository
Umami uses pnpm as its package manager. Make sure you have it installed before proceeding.
Installation Steps
Install Node.js
Ensure you have Node.js 18.18 or higher:If you need to install or update Node.js, visit nodejs.org or use a version manager like nvm:
Set Up PostgreSQL Database
You need a running PostgreSQL database. Install PostgreSQL if you haven’t already:Create a database for Umami:In the PostgreSQL shell:
- Ubuntu/Debian
- macOS
- Windows
Install Dependencies
Install all required packages using pnpm:This will install all dependencies listed in
package.json, including:- Next.js 15.5.9
- React 19.2.3
- Prisma 6.18.0
- And all other required packages
Configure Environment Variables
Create a Add the following configuration:Connection URL format:Example:
.env file in the root directory:.env
Build the Application
Build Umami, which will also set up the database schema:This command will:
- Check environment variables
- Generate the Prisma client
- Run database migrations
- Build the tracker script
- Build the Next.js application
- Create default admin user
The build process automatically creates tables and a default admin account:
- Username:
admin - Password:
umami
Development Mode
For development with hot reloading:Development mode runs on port 3001 by default (not 3000) and includes:
- Hot module replacement
- Detailed error messages
- Turbopack for faster builds
Build Scripts Explained
Umami’s build process includes several important steps:pnpm run build
pnpm run build
Complete production build:This runs:
check-env- Validates required environment variablesbuild-db- Generates Prisma clientcheck-db- Verifies database connectionbuild-tracker- Builds the tracking script (script.js)build-geo- Downloads GeoIP databuild-app- Builds Next.js application
pnpm run update-db
pnpm run update-db
Run database migrations:Use this when updating to a new version to migrate the database schema.
pnpm run build-tracker
pnpm run build-tracker
Rebuild just the tracking script:Useful if you’ve modified the tracker source code.
Configuration Options
Change Port
To run on a different port:Use Custom Base Path
If serving Umami from a subdirectory:.env
http://localhost:3000/analytics
Updating Umami
To update to the latest version:Running as a Service
Using PM2
PM2 is a process manager that keeps Umami running:Using systemd (Linux)
Create a systemd service file:/etc/systemd/system/umami.service
Troubleshooting
Build fails with DATABASE_URL error
Build fails with DATABASE_URL error
Make sure your Test database connection:
.env file exists and contains a valid DATABASE_URL:Port already in use
Port already in use
Change the port:Or find what’s using port 3000:
Prisma client generation fails
Prisma client generation fails
Manually generate the Prisma client:If issues persist, delete generated files:
Database migration errors
Database migration errors
Reset the database (WARNING: deletes all data):Then rebuild:
Missing dependencies error
Missing dependencies error
Clear pnpm cache and reinstall:
Production Deployment
Next Steps
Environment Variables
Configure advanced features
Database Setup
Optimize database configuration
Add Website
Start tracking analytics
Production Guide
Deploy to production