Skip to main content
  1. Posts/

Install umami

··243 words·2 mins·
Install umami

Requirements #

  • Node.js version 18.17 or newer
  • MySQL version 8.0 or newer OR PostgreSQL version v12.14 or newer
MariaDB is not supported because it doesn’t implement the BIN_TO_UUID function.

Packages #

apt install curl git postgresql-15

Node.js #

curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && apt-get install -y nodejs

Yarn #

Install Yarn:

npm install -g yarn

PostgreSQL #

Connect to PostgreSQL:

sudo -u postgres psql

Create the database:

CREATE DATABASE umami;

Create the user:

CREATE USER umami WITH ENCRYPTED PASSWORD 'UMAMI_DB_PASSWORD';

Set the permissions:

GRANT ALL PRIVILEGES ON DATABASE umami TO umami;

Change the database:

\c umami

Set the schema:

GRANT ALL ON SCHEMA public TO umami;

Exit from psql:

\q

Create user and group #

Create the group first:

groupadd --system umami

Create the umami user:

useradd --system --gid umami --create-home  --home-dir /var/umami --shell /usr/sbin/nologin umami

Download #

Clone the GitHub repository:

git clone https://github.com/umami-software/umami /opt/umami

Change the owner of the source:

chown -R umami:umami /opt/umami

Switch to umami user:

sudo -u umami /bin/bash

Install the packages #

cd /opt/umami
yarn install

Configure #

Create a .env file:

nano .env

Configure the DB connection:

DATABASE_URL="postgresql://umami:UMAMI_DB_PASSWORD@localhost:5432/umami"
DATABASE_TYPE="postgresql"
APP_SECRET="UMAMI_APP_SECRET"

Set permission for the file:

chmod 0640 .env

Build #

yarn build
The default username is admin and the password is umami

Configure systemd #

Create the systemd service:

nano "/etc/systemd/system/umami.service"
[Unit]
Description=Umami
After=postgresql@15-main.service
Requires=postgresql@15-main.service

[Service]
Type=exec
User=umami
Group=umami
WorkingDirectory=/opt/umami
ExecStart=yarn start

[Install]
WantedBy=multi-user.target

Reload systemd to load the new service:

systemctl daemon-reload

Enable the service to start at boot:

systemctl enable --now umami