Skip to content
🧮 Is Lifetime with ZapX Pass worth it? Work it out for your own servers in 30 seconds. Open the Lifetime calculator →

Set Up Kimai on a Linux Server – Track and Bill Work Hours

Set up Kimai on your VPS: track time with the One-Click App or Docker Compose, including an admin account, HTTPS, exports, and invoices.

3 December 202611 min read2 Views0 helpful

Introduction

Kimai is a free time-tracking application that you use in your browser. Add customers, projects, and activities, track your working hours with a start and stop timer or enter them later, and review them afterward. Kimai can export tracked time as CSV, Excel, or PDF files and, if you want, create ready-to-send invoices. Multiple people can work in the same instance using their own accounts and roles.

In this guide, we’ll show you two ways to get started: the easy way, using the One-Click App, which gets Kimai up and running with HTTPS and a ready-to-use admin account in just a few minutes, and a manual installation with Docker Compose. Then you’ll add your first customer and project, track some time, and export it.

When Kimai makes sense on a VPS

Running your own time-tracking application on your VPS is especially useful if:

  • You bill by the hour. Kimai calculates rates per customer, project, or activity and shows the amount directly in the export.
  • Your whole team tracks time. Each person gets their own account, team leads can see their team’s time, and admins can see everything.
  • You want to keep your data to yourself. Working hours and customer data are stored in your own database, not with a third-party provider.
  • You don’t want to pay per user. The self-hosted version of Kimai is free, no matter how many accounts you create.
  • You want to process tracked time further. Exports, a REST API, and invoice templates make tracked time useful for accounting and customers.

Kimai is less suitable if you need full accounting features such as quotes, payment tracking, and payment reminders. Kimai creates invoices from tracked time, but it doesn’t replace an invoicing program. Invoice Ninja may be a better fit for that.

Easy option: Kimai as a One-Click App

The quickest way to get Kimai is through your VPS’s One-Click Apps. The app includes its own MySQL database, is directly accessible over HTTPS with a domain, and creates your admin account during installation. Public registration is disabled.

Requirements

  • A Linux VPS (Debian or Ubuntu) with One-Click Apps set up. See Set up One-Click Apps for instructions.
  • At least 1 GB of available RAM; 2 GB is recommended. MySQL alone uses around 400 to 500 MB. Plan for at least 3 GB of storage; 10 GB is recommended.

Install

  1. Open your VPS in the ZapX dashboard and switch to the One-Click Apps tab.
  2. Search the app catalog for Kimai and click Install app.
  3. Use a custom subdomain or zap.cloud is already selected. Leave the option enabled and, if needed, enter a custom name, such as times. This lets you access Kimai over HTTPS.
  4. App configuration contains five optional fields:
    • ADMINMAIL: the email address for your admin account. The default is admin@kimai.local. It’s best to enter your own address now, as links such as password-reset links will be sent there later.
    • MAILER_URL and MAILER_FROM: your mail server connection details and the sender address. With the default value null://null, Kimai won’t send emails. You can fill these in later; see below.
    • MYSQL_DATABASE: the database name. Leave it as kimai.
    • TRUSTED_HOSTS: Leave this field empty. The app is only accessible through your domain anyway.
  5. Click Queue installation.

The panel automatically generates five values: your admin password (SERVICE_PASSWORD_ADMINPASS), MySQL usernames and passwords, and a secret key for Kimai. On its first startup, Kimai sets up the database and creates the admin account. Depending on server load, this takes a few minutes. The app card will then show Online.

If the app card instead shows Failed with a message that the mysql-… container was not ready (unhealthy), the database simply took too long to start the first time. Click Redeploy on the app card and confirm with Reinstall app, without selecting the option to delete the data volumes. Kimai will then start with the database, which should now be ready.

First login

  1. Open the App environment tab using the gear icon on the app card. Your password is listed under Automatically generated values as SERVICE_PASSWORD_ADMINPASS. Click the eye icon to show it, or the icon next to it to copy it.
  2. Open Kimai using the Access link on the app card. You’ll land on the login page.
  3. Enter admin or the address from ADMINMAIL as the username, then enter the generated password and log in.

The first time you log in, a short wizard will guide you through your profile settings. Select Language (the interface language, for example German), your date, time, and currency formats, and your Timezone. You’ll then land on your time overview. Your account has the System Admin role and can change all settings. The app card also shows a Login notice explaining that the login details were generated during installation and are available under App environment. You don’t need the other generated values to log in.

Info: Generated values only apply to the first startup

Kimai only creates the admin account if it doesn’t already exist. If you change ADMINMAIL later in App environment, it won’t change your account. A password changed in Kimai also won’t be reflected in App environment. Save your password in your password manager.

To change your password, click your initials in the top-right corner of Kimai and select Password. From the same menu, enable two-factor authentication under Two-Factor (2FA). We recommend this for every admin account.

Tip: Does an older installation redirect to http://?

If your Kimai installation is older and the address briefly changes to http:// after you log in, it’s missing the setting for the proxy in front of the app. Open App environment, click the plus icon next to Custom environment variables, and enter TRUSTED_PROXIES as the Key and 127.0.0.1,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16 as the Value. Click Save. The app will restart and will use HTTPS throughout.

Set up email delivery

Kimai works fully without a mail server; it just won’t send emails. This mainly affects Forgot password on the login page: the password-reset link won’t arrive. To send emails, enter the details of a mailbox, such as one from your email provider:

  1. Open the App environment tab using the gear icon on the app card.
  2. For MAILER_URL, enter the connection details in the format smtp://USERNAME:PASSWORD@smtp.example.com:587. For MAILER_FROM, enter the sender address, for example times@example.com.
  3. Click Save. The app will restart with the new values.

If your password contains characters such as @, :, #, or +, you need to encode them in the address (@ becomes %40, # becomes %23); otherwise, sending will fail.

Tip: Why port 587?

On new VPSs, outgoing connections on ports 25 and 465 are blocked until you verify a phone number on your account. Port 587 isn’t affected and works right away.

If you don’t want to use email at all, disable password resets by email: in Kimai, go to System > Settings > Authentication, clear Forgot password, and save. An admin can then reset forgotten passwords under System > Users.

Updates and backups

Update Kimai in the app settings (gear icon) under App update. Click Check for updates, then 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. Kimai applies any required database changes automatically on startup.

Your time entries, customers, and settings are stored in the app’s MySQL database. Back up the entire VPS from Backups in the dashboard. It’s also a good idea to create a database dump before each update. To do this, connect over SSH and find the name of the database container:

Code
docker ps --format '{{.Names}}' | grep mysql

Use the name shown (it starts with mysql-) to write the database to a file:

Code
docker exec mysql-XXXX sh -c 'mysqldump --no-tablespaces -u"$MYSQL_USER" -p"$MYSQL_PASSWORD" "$MYSQL_DATABASE"' > /root/kimai-$(date +%F).sql

Replace mysql-XXXX with the name from the list. The command reads the credentials directly from the container, so you don’t need to type them in. Don’t keep the file only on your VPS.

Manual installation

The rest of this guide describes a manual installation of Kimai with Docker Compose. For example, you might use this option if you aren’t using One-Click Apps on your server or want to run Kimai behind your own reverse proxy. We’ll use Kimai’s official image and MySQL as the database.

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 with an A record pointing to your VPS’s IP address (e.g., kimai.example.com).
HardwareMinimumRecommended
CPU1 vCPU core2 vCPU cores
RAM1 GB2 GB
Storage3 GB10 GB

Prepare the firewall

In this guide, Kimai itself is only accessible from the server. Only SSH and the ports for the reverse proxy are exposed externally. With ufw:

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

Ports published by Docker using ports: are also reachable from the internet, even if ufw blocks them. Docker inserts its own rules ahead of those from ufw. So, bind Kimai only to 127.0.0.1, as described below. For more on firewalls, see Manage the firewall on Linux.

Install with Docker Compose

Create a directory and generate passwords and a secret key in the .env file:

Code
mkdir -p /opt/kimai && cd /opt/kimai
cat > .env <<EOF
DB_PASSWORD=$(openssl rand -hex 16)
DB_ROOT_PASSWORD=$(openssl rand -hex 16)
APP_SECRET=$(openssl rand -hex 32)
ADMIN_PASSWORD=$(openssl rand -hex 12)
EOF
chmod 600 .env
grep ADMIN_PASSWORD .env

Make a note of the admin password shown. Then create the docker-compose.yml file (nano docker-compose.yml) and add the following content. Replace kimai.example.com and admin@example.com with your domain and email address:

Code
services:
  db:
    image: mysql:8.4
    restart: unless-stopped
    command: --default-storage-engine innodb
    environment:
      - MYSQL_DATABASE=kimai
      - MYSQL_USER=kimai
      - MYSQL_PASSWORD=${DB_PASSWORD}
      - MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
    volumes:
      - mysql:/var/lib/mysql
    healthcheck:
      test: mysqladmin ping -h 127.0.0.1 --silent
      interval: 10s
      timeout: 5s
      retries: 12
      start_period: 30s

  kimai:
    image: kimai/kimai2:2
    restart: unless-stopped
    depends_on:
      db:
        condition: service_healthy
    ports:
      - "127.0.0.1:8001:8001"
    environment:
      - APP_SECRET=${APP_SECRET}
      - ADMINMAIL=admin@example.com
      - ADMINPASS=${ADMIN_PASSWORD}
      - "DATABASE_URL=mysql://kimai:${DB_PASSWORD}@db/kimai?charset=utf8mb4&serverVersion=8.4.0"
      - "TRUSTED_HOSTS=kimai.example.com|localhost|127.0.0.1"
      - "TRUSTED_PROXIES=127.0.0.1,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"
      - MAILER_FROM=kimai@example.com
      - MAILER_URL=null://null
    volumes:
      - data:/opt/kimai/var/data
      - plugins:/opt/kimai/var/plugins

volumes:
  mysql:
  data:
  plugins:

Here’s what the important lines do:

  • image: kimai/kimai2:2: the official image for major version 2. Running docker compose pull gets you every new 2.x version, but won’t upgrade to a new major version.
  • ADMINMAIL and ADMINPASS: On the first startup, Kimai uses these values to create the admin account with full permissions. If the account already exists, it remains unchanged.
  • APP_SECRET: a long, random key that Kimai uses to secure logins, among other things. Don’t change it later.
  • 127.0.0.1:8001:8001: Kimai is only accessible from the server itself; external access is only available through the reverse proxy.
  • TRUSTED_HOSTS: the addresses Kimai is allowed to respond to. Enter your domain. You need localhost and 127.0.0.1 for the first access through an SSH tunnel.
  • TRUSTED_PROXIES: Kimai only trusts these addresses to indicate that a connection came through HTTPS. Without this line, Kimai redirects to http:// after login. The shorthand PRIVATE_SUBNETS doesn’t work here, so enter the networks in full.
  • MAILER_URL and MAILER_FROM: same as for the One-Click App; null://null won’t send emails.
  • Volumes: mysql contains the database; data and plugins contain files stored by Kimai itself and any extensions.

Pull the images and start the containers:

Code
docker compose pull
docker compose up -d
docker compose logs -f kimai

The first startup takes one to two minutes. When the log shows Kimai is ready, stop viewing the output with Strg + C.

First access

Before making Kimai accessible publicly, you can test the installation through an SSH tunnel. Run this on your own computer:

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

Then open http://localhost:8001 in your browser and log in with admin and the password from .env. The same short wizard as in the One-Click App will guide you through the language, format, and time zone settings.

Access over HTTPS using a reverse proxy

To access Kimai over the internet, set up a reverse proxy with a valid certificate in front of it. For the basics, see Set up a reverse proxy with nginx and Create an SSL certificate (Let's Encrypt). Here’s a server block for nginx:

Code
server {
    listen 80;
    server_name kimai.example.com;
    client_max_body_size 20m;

    location / {
        proxy_pass http://127.0.0.1:8001;
        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 $scheme;
        proxy_set_header X-Forwarded-Host $host;
    }
}

Then get the certificate with certbot --nginx -d kimai.example.com. Certbot will add HTTPS and an HTTP redirect to the block. The X-Forwarded- lines tell Kimai which address and protocol the browser is using. Together with TRUSTED_PROXIES, this keeps every page on HTTPS.

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

Back up your data

The most important thing to back up is the database. You can back it up while it’s running:

Code
cd /opt/kimai
docker compose exec -T db sh -c 'mysqldump --no-tablespaces -u"$MYSQL_USER" -p"$MYSQL_PASSWORD" "$MYSQL_DATABASE"' > /root/kimai-$(date +%F).sql
docker compose cp kimai:/opt/kimai/var/data /root/kimai-data-$(date +%F)
cp .env docker-compose.yml /root/

The second line copies the files from Kimai’s data directory, and the third copies the passwords and Compose file. Keep everything together somewhere outside your VPS. To restore, start Kimai using the same version and .env file, then restore the database:

Code
docker compose exec -T db sh -c 'mysql -u"$MYSQL_USER" -p"$MYSQL_PASSWORD" "$MYSQL_DATABASE"' < /root/kimai-DATE.sql

Update Kimai

Back up your data first, as described above. To update within major version 2, run:

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

Kimai applies any required database changes automatically on startup. You can view them in the log with docker compose logs kimai. Before making a major version upgrade, check the Kimai update notes. docker image prune then removes the old images.

Track time with Kimai

Once Kimai is set up, first create its structure: customers, projects for those customers, and related activities. Every time entry will belong to exactly one project and one activity. We’ll use the labels from the English interface. If you selected German in your profile, the menu names will be different.

Add customers, projects, and activities

  1. Go to Administration > Customers on the left and click Create. The required fields are Name, Country, Currency, and Timezone. Save the customer.
  2. In the customer’s details, open Prices and add an hourly rate, for example, 80. Kimai will use this to calculate the amount for each time entry.
  3. Go to Administration > Projects, click Create, enter a Name, and select your customer under Customer.
  4. Go to Administration > Activities, click Create, and add an activity, such as “Development.” If you leave Project empty, the activity will be available in all projects.

Instead of adding rates to a customer, you can add them to a project or activity if the rates differ.

Track time

To start tracking your current work, click the play icon in the top-right corner of the bar. Select a project and activity, and Kimai will track the time. Stop the timer by clicking the running-time display in the same place or in your time list. To enter time afterward, go to Time Tracking > My times and click Create. Enter the date and start time under From, the duration or end time under Duration / End, select a Project and Activity, and add a Description if needed.

Under Weekly hours, enter time for an entire week in a table. Under Calendar, view your time in a calendar. As an admin, go to System > Settings to configure how Kimai rounds time, whether entries in the future are allowed, and whether employees can only clock in and out instead of editing time entries.

Exports and invoices

Go to Time Tracking > Export, filter by date range, customer, or project, and click Search. Kimai will show a preview with the duration and amount. Select CSV, Excel, PDF, or Print below it. Click Mark as exported to flag the entries so they won’t appear again in the next export.

To create invoices, first set up a template under Invoices > Invoice template. Enter a name, title, issuer (a customer you’ve added in Kimai with your own company details), payment terms in days, tax rate, and language. Then go to Invoices > Create invoice, select a customer and date range, click Search, and review the invoice using Preview before saving it. You can find saved invoices under Invoice history.

Additional users and teams

As an admin, create accounts for other people under System > Users. Set their username, email address, password, and role there:

RolePermissions
User (default role for every account)Track their own time, view basic reports, and change their own settings
TeamleadAlso view their teams’ time and create invoices
AdministratorManage all customers, projects, activities, and time entries, but not users or system settings
System-AdminManage everything, including users, roles, plugins, and system settings

Under System > Teams, group people together and restrict customers or projects to specific teams. You can customize each role’s permissions under System > Roles. There’s no registration page where outsiders can create their own accounts.

Limitations

  • No dedicated smartphone app: Kimai runs in a browser and adapts to smaller screens. Third-party providers offer apps and desktop programs that work with the REST API. Each user can create an API key in their profile under API Access.
  • Invoicing without accounting: Kimai creates invoices from time entries, but doesn’t track payments or payment reminders.
  • Some extensions cost money: Many additional features, such as expenses or custom fields, are available as plugins in the Kimai store, often for a fee. The core features described in this guide are free.

Conclusion

With Kimai, you now track working hours for yourself or your team on your own server, bill them using hourly rates and pass them on as an export or invoice. If you also need quotes, incoming payments and reminders, the guide Set Up Invoice Ninja on a Linux Server shows you how to run your own invoicing software for that.

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

For the One-Click App, the username is admin. You can also log in using the email address from ADMINMAIL. The panel generates your password during installation. Find it by clicking the gear icon on the app card and opening the App environment tab, where it’s listed as SERVICE_PASSWORD_ADMINPASS. There are no default passwords like those used by some demo installations.
There’s no registration page where people can create their own accounts. As an admin, create accounts under System > Users, and enter a username, email address, password, and role. Every account can track time; Teamleads, Administrators, and System Admins can manage additional features.
By default, MAILER_URL is set to null://null, so Kimai doesn’t send emails. In App environment, enter your mailbox details for MAILER_URL, for example smtp://user:password@smtp.example.com:587, and a sender address for MAILER_FROM. Use port 587, since ports 25 and 465 are blocked on new VPSs until you verify a phone number. If email isn’t set up, an admin can reset forgotten passwords under System > Users.

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.