Time Tracking: Kimai1 on OpenBSD
Tags: kimai, timetracking, opensource, installation
Published: 2019-05-11 18:52:47

---
title: Time Tracking: Kimai1 on OpenBSD
published: true
description: Kimai is time-tracking app. It's open source, published under MIT license. There are both Kimai1 and Kimai2. I'll show how to install Kimai1 in this post.
tags: kimai, time tracking, open source, installation
cover_image: https://thepracticaldev.s3.amazonaws.com/i/7g2zxq9odsmdaxz7cntq.png
series: Time Tracking - Kimai on OpenBSD
canonical_url: https://dev.to/nabbisen/time-tracking-kimai2-on-openbsd-2mk9
---

## Introducation

[Kimai](https://www.kimai.org/) is open source time-tracking app.
There are two major versions: [Kimai1](https://github.com/kimai/kimai), which is [GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html) licensed, and [Kimai2](https://github.com/kevinpapst/kimai2), which is [MIT](https://opensource.org/licenses/MIT) licensed.
I'll show how to install Kimai1 in this post.

I tried to install both of Kimai1 and Kimai2.
Why also Kimai1?
It's because Kimai2 didn't have Japanese translation!
(Besides, I made pull request about it today. Aha.)

#### Environment

- OS: [OpenBSD](https://www.openbsd.org/) 6.5
- Database: [MariaDB](https://mariadb.org/) 10.0
- Web Server: [httpd](https://man.openbsd.org/httpd.8)
- CGI: [PHP-FPM](https://php-fpm.org/) powered by [PHP](https://php.net/) 7.2
- Time-Tracking App: Kimai 1.3.1

## Tutorial

The official installation manual is [here](https://www.kimai.org/v1/installation.html).

#### Requirements

First of all, you have to have:

- [httpd as web server](https://dev.to/nabbisen/setting-up-openbsds-httpd-web-server-4p9f)
- [php-fpm](https://dev.to/nabbisen/php-fpm-on-openbsd-2iof)
- [MariaDB as database server](https://dev.to/nabbisen/installing-mariadb-server-on-openbsd-5lm)

Additionally, [HTTPS is recommended](https://dev.to/nabbisen/lets-encrypt-certbot-for-openbsds-httpd-3ofd).

#### DB server

Create database and user:

```sql
CREATE DATABASE <database> CHARACTER SET = 'utf8mb4';
GRANT ALL PRIVILEGES ON <database>.* TO <dbuser> IDENTIFIED BY '<dbpass>';
```

#### App server

Get the package:

```console
$ ftp https://github.com/kimai/kimai/releases/download/1.3.1/kimai_1.3.1.zip

$ unzip kimai_1.3.1.zip -d kimai1
```

Then modify the permissions:

```console
$ cd kimai1

# chown -R :www .
# chmod -R g+r .
# chmod -R g+rw {temporary,temporary/logfile.txt,includes}
```

#### Web server

Add configuration:

```apache
server "<fqdn>" {
        listen on $ext_addr port 80
        block return 301 "https://$SERVER_NAME$REQUEST_URI"
}
server "<fqdn>" {
        listen on $ext_addr tls port 443
        tls {
                certificate     "/etc/letsencrypt/live/<fqdn>/fullchain.pem"
                key             "/etc/letsencrypt/live/<fqdn>/privkey.pem"
        }
 
        root "/<...>/kimai1"
        directory index index.php
 
        location "/*.php" { 
                fastcgi socket "/run/php-fpm.sock"
        } 
        location "/*.php[/?]*" {
                fastcgi socket "/run/php-fpm.sock"
        }
}
```

Then restart the web server:

```console
# rcctl restart httpd
```

Now we can run the web installer with browsers.
Let's go to `https://<fqdn>`.

#### Web Installer

Follow the guidance:

![web install](https://thepracticaldev.s3.amazonaws.com/i/hjesnkfw0epasddmk6eu.png)
![web install](https://thepracticaldev.s3.amazonaws.com/i/8meji6cdbhag99g4zit7.png)
![web install](https://thepracticaldev.s3.amazonaws.com/i/480y9i0qq0ct386qfwrc.png)
![web install](https://thepracticaldev.s3.amazonaws.com/i/qt54pd014sm5mugdkj5x.png)
![web install](https://thepracticaldev.s3.amazonaws.com/i/bm369vwe8c39fbpgkqld.png)
![web install](https://thepracticaldev.s3.amazonaws.com/i/ovxqs4yo1eqjttpw3lo8.png)
![web install](https://thepracticaldev.s3.amazonaws.com/i/ypqwkhvjslhgv31l6ju1.png)

\* Caution: Replace `localhost` with `127.0.0.1` as needed. 

![web install](https://thepracticaldev.s3.amazonaws.com/i/euwcse07m7e51wfu5655.png)
![web install](https://thepracticaldev.s3.amazonaws.com/i/803l0gibtu8wfazfdk67.png)

Installation is now ready.
It starts by clicking the "Install" button.

![login form](https://thepracticaldev.s3.amazonaws.com/i/es3hjuuwl157mz1t26v5.png)

We have reached the login form.
The initial settings are:

- Username: admin
- Password: changeme

![succeeded](https://thepracticaldev.s3.amazonaws.com/i/86upi8lm72tsj5f5g6n6.png)

OK!
Remove the installer:

```console
$ rm -rf installer
```

Than's all!

## Conclusion

These are usage screenshot examples.
Unique and cool design. I sometimes feel kinda nostalgia somehow... :)

![usage](https://thepracticaldev.s3.amazonaws.com/i/fz3tv899u15855qonnzx.png)
![usage](https://thepracticaldev.s3.amazonaws.com/i/7zkb26vkimwe76tnapk5.png)
![usage](https://thepracticaldev.s3.amazonaws.com/i/vqjm32sgwii8k2ccycye.png)

Thank you for your reading.
Happy computing.