### Install Composer Source: https://www.kimai.org/documentation/fresh-ubuntu-20.html Executes the Composer installer, removes the setup script, makes the Composer executable, and moves it to the system's PATH. ```bash php composer-setup.php php -r "unlink('composer-setup.php');" chmod +x composer.phar mv composer.phar /usr/bin/composer ``` -------------------------------- ### Run Kimai Installation Command Source: https://www.kimai.org/documentation/installation.html Execute the Kimai installer to complete the setup. You may need to prefix this command with 'php' or a specific PHP version. ```bash bin/console kimai:install -n ``` ```bash php bin/console kimai:install -n ``` ```bash php8.3 bin/console kimai:install -n ``` -------------------------------- ### Install Kimai Application Source: https://www.kimai.org/documentation/shared-hosting.html Run the Kimai installation command. The -n flag indicates a non-interactive installation. ```bash ./bin/console kimai:install -n ``` -------------------------------- ### Start and Enable Fail2Ban Service Source: https://www.kimai.org/documentation/fresh-ubuntu-22.html Start the Fail2Ban service and configure it to start automatically on system boot. ```bash service fail2ban start systemctl enable fail2ban ``` -------------------------------- ### Install Kimai Application (Netcup) Source: https://www.kimai.org/documentation/shared-hosting.html Installs Kimai using the console command. This is typically run after installing dependencies. ```bash php bin/console kimai:install -n ``` -------------------------------- ### Install Essential Software Source: https://www.kimai.org/documentation/fresh-ubuntu-22.html Installs Git, unzip, curl, vim, MariaDB, and Nginx on Ubuntu. This is a prerequisite for setting up Kimai. ```bash apt-get update apt-get upgrade apt-get install git unzip curl vim mariadb-server mariadb-client nginx apt-get install software-properties-common ``` -------------------------------- ### Minimal OpenLDAP Setup with Role Sync Source: https://www.kimai.org/documentation/ldap.html A basic configuration for local OpenLDAP with role synchronization. This example demonstrates default value usage for user and role base DNs. ```yaml kimai: ldap: activate: true connection: host: 127.0.0.1 user: baseDn: ou=users, dc=kimai, dc=org role: baseDn: ou=groups, dc=kimai, dc=org ``` -------------------------------- ### Install Essential System Packages Source: https://www.kimai.org/documentation/fresh-ubuntu-20.html Updates the package list and installs Git, unzip, curl, and Vim. Also installs MariaDB server and client, and Nginx web server. ```bash apt update apt upgrade apt install git unzip curl vim apt install mariadb-server mariadb-client apt install nginx ``` -------------------------------- ### Install Composer on Domainfactory Source: https://www.kimai.org/documentation/shared-hosting.html Manually install Composer using a specific PHP version CLI command, downloading the installer and executing it. ```bash curl -sS https://getcomposer.org/installer | php8.1.5-cli ``` -------------------------------- ### Install Composer Source: https://www.kimai.org/documentation/fresh-ubuntu-18.html Download and verify the Composer installer script. This ensures the integrity of the installation before proceeding. ```bash php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php -r "if (hash_file('sha384', 'composer-setup.php') === '48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe587c3f0fe57a54d8f5') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" ``` ```bash php composer-setup.php php -r "unlink('composer-setup.php');" chmod +x composer.phar mv composer.phar /usr/bin/composer ``` -------------------------------- ### Run Kimai Installation and User Creation Source: https://www.kimai.org/documentation/fresh-ubuntu-18.html Execute the Kimai installation command and create an initial administrator user with a super admin role. ```bash bin/console kimai:install -n bin/console kimai:user:create admin admin@example.com ROLE_SUPER_ADMIN ``` -------------------------------- ### Clone Kimai Repository and Install Dependencies Source: https://www.kimai.org/documentation/developers.html Clones the Kimai repository and installs PHP dependencies using Composer. This is the first step for a native installation. ```bash git clone https://github.com/kimai/kimai.git cd kimai/ composer install ``` -------------------------------- ### Install Fail2Ban and Clone Plugin Source: https://www.kimai.org/documentation/fresh-ubuntu-22.html Install the Fail2Ban service and clone the Kimai Fail2Ban plugin from its GitHub repository. ```bash apt-get install fail2ban cd /var/www/kimai/var/plugins/ git clone https://github.com/Keleo/Fail2BanBundle.git ``` -------------------------------- ### Start Kimai Application Container Source: https://www.kimai.org/documentation/docker.html Starts the Kimai application container in production environment, mapping port 8001 and connecting to the previously started MySQL database. Use 'host.docker.internal' for hostname if facing connection issues. ```bash docker run --rm --name kimai-test \ -d \ -ti \ -p 8001:8001 \ -e APP_ENV="prod" \ -e DATABASE_URL="mysql://kimai:kimai@host.docker.internal:3456/kimai?charset=utf8mb4&serverVersion=9.5.0" \ kimai/kimai2:apache ``` -------------------------------- ### Install Plugin Database Tables Source: https://www.kimai.org/documentation/plugin-management.html Installs necessary database tables for a plugin. This command is typically run after installing or updating a plugin. ```bash bin/console kimai:bundle:foobar:install ``` -------------------------------- ### Install Required Software Packages Source: https://www.kimai.org/documentation/fresh-ubuntu-18.html Installs essential software packages for PHP, web server, database, and other utilities using apt-get. ```bash apt-get update apt-get install php-fpm php-cli php-common php-json php-opcache php-readline php-xml php-zip php-intl php-gd php-mbstring php-mysql php-curl apt-get install mysql-server mysql-client apt-get install nginx apt-get install git unzip curl ``` -------------------------------- ### Install Kimai on All-Inkl Source: https://www.kimai.org/documentation/shared-hosting.html Install Kimai using the 'php81' CLI command, ensuring the correct PHP version is used for the installation. ```bash php81 bin/console kimai:install -n ``` -------------------------------- ### Install Kimai on Domainfactory Source: https://www.kimai.org/documentation/shared-hosting.html Install Kimai using a specific PHP version CLI command, ensuring the correct PHP version is used for the installation process. ```bash php8.1.5-cli bin/console kimai:install -n ``` -------------------------------- ### Install Composer Dependencies (HostEurope) Source: https://www.kimai.org/documentation/shared-hosting.html Installs Kimai dependencies using Composer. This command is suitable for HostEurope hosting environments. ```bash php composer.phar install --no-dev --optimize-autoloader ``` -------------------------------- ### Install Composer Packages on Strato Source: https://www.kimai.org/documentation/shared-hosting.html After cloning Kimai and navigating to its directory, use this command to install necessary Composer packages. The `--no-dev` and `--optimize-autoloader` flags are recommended for production environments. ```bash ../composer.phar install --no-dev --optimize-autoloader ``` -------------------------------- ### Install Frontend Dependencies with PNPM Source: https://www.kimai.org/documentation/developers.html Installs frontend dependencies required for making changes to CSS or Javascript. Ensure NodeJS and PNPM are installed first. ```bash pnpm install ``` -------------------------------- ### Fetch Latest Code and Install Dependencies Source: https://www.kimai.org/documentation/updates.html Update your Kimai installation by fetching the latest code and installing all composer dependencies. This ensures you have the most recent version and all necessary packages. ```bash git checkout -- composer.lock git fetch --tags git checkout 2.60.0 composer install --no-dev --optimize-autoloader ``` -------------------------------- ### User Preference Examples Source: https://www.kimai.org/documentation/api-example-user.html Examples of user preference configurations for different contract types. ```APIDOC ## User Preference Examples ### Type “month” - Total monthly hours ```json [ {"name": "work_contract_type", "value": "month"}, {"name": "hours_per_month", "value": "432000"}, {"name": "work_days_month", "value": "1,2,3,4,5"} ] ``` ### Type “week” - Total weekly hours ```json [ {"name": "work_contract_type", "value": "week"}, {"name": "hours_per_week", "value": "144000"}, {"name": "work_days_week", "value": "1,2,3,4,5"} ] ``` ### Type `day` - Individual daily hours ```json [ {"name": "work_contract_type", "value": "day"}, {"name": "work_monday", "value": "28800"}, {"name": "work_tuesday", "value": "28800"}, {"name": "work_wednesday", "value": "28800"}, {"name": "work_thursday", "value": "28800"}, {"name": "work_friday", "value": "14400"} ] ``` ``` -------------------------------- ### Install Kimai on Ionos/1&1 Source: https://www.kimai.org/documentation/shared-hosting.html Install Kimai using a specific PHP version CLI command, ensuring compatibility with the hosting environment. ```bash /usr/bin/php8.1-cli bin/console kimai:install -n ``` -------------------------------- ### SMTP Configuration Examples Source: https://www.kimai.org/documentation/emails.html Examples for configuring the MAILER_URL for various SMTP providers and settings. These include basic SMTP, Gmail, Brevo, Sendgrid, and configurations with authentication, SSL, and TLS encryption. ```env MAILER_URL=null://null ``` ```env MAILER_URL=smtp://localhost:25 ``` ```env MAILER_URL=sendmail://default ``` ```env MAILER_URL=smtps://{username}:{password}@smtp.gmail.com:465 ``` ```env MAILER_URL=smtps://{username}:{password}@smtp-relay.brevo.com:465 ``` ```env MAILER_URL=smtps://{username}:{password}@smtp.sendgrid.net:465 ``` ```env MAILER_URL=smtp://user:password@smtp.example.com:25 ``` ```env MAILER_URL=smtp://info@example.com:password@smtp.example.com:25 ``` ```env MAILER_URL=smtp://info@example.com:password@smtp.example.com:443?encryption=ssl ``` ```env MAILER_URL=smtp://user:password@smtp.example.com:587?encryption=tls ``` -------------------------------- ### Install Composer Source: https://www.kimai.org/documentation/shared-hosting.html Downloads and installs the Composer dependency manager. This command might vary depending on the server's PHP configuration. ```bash curl -sS https://getcomposer.org/installer | /usr/bin/php ``` -------------------------------- ### Install KioskBundle Plugin via Docker Exec Source: https://www.kimai.org/documentation/synology.html Commands to execute within the Kimai Docker container to clear cache and install a specific plugin after manual volume mounting. ```bash docker exec -it kimai /bin/bash cd /opt/kimai/var/cache/ rm -rf pro* cd /opt/kimai/ bin/console kimai:bundle:kiosk:install ``` -------------------------------- ### Install Composer Dependencies (Netcup) Source: https://www.kimai.org/documentation/shared-hosting.html Installs Kimai dependencies using Composer, overriding memory limits for the process. This command is for Netcup hosting and may require specifying the PHP version. ```bash COMPOSER_MEMORY_LIMIT=-1 php -d memory_limit=-1 composer.phar install --no-dev --optimize-autoloader ``` -------------------------------- ### Start Kimai and Caddy Source: https://www.kimai.org/documentation/hosting-digital-ocean.html Use this command to initiate Kimai and Caddy services. It may take a few minutes for DNS and SSL to become available. ```bash docker compose up -d ``` -------------------------------- ### Start Symfony Local Web Server Source: https://www.kimai.org/documentation/developers.html Starts the Symfony local web server on port 8010, recommended for local development and HTTPS setup. ```bash symfony serve --port=8010 ``` -------------------------------- ### Import MR Plugins Data Source: https://www.kimai.org/documentation/plugin-contract.html Run this command from the bash to start the data import process from MR Plugins after installing the working contract plugin. Follow the on-screen prompts to complete the migration. ```bash bin/console kimai:bundle:workcontract:import-mr ``` -------------------------------- ### Start Kimai with Docker Source: https://www.kimai.org/documentation/developers.html Launches the Kimai development container. Ensure the `DATABASE_URL` correctly points to your running MySQL instance, using `host.docker.internal` for the host if necessary. ```bash docker run --rm --name kimai-dev \ -d \ -ti \ -p 8001:8001 \ -e APP_ENV="dev" \ -e DATABASE_URL="mysql://kimai:kimai@host.docker.internal:3457/kimai?charset=utf8mb4&serverVersion=9.5.0" \ kimai/kimai2:dev ``` -------------------------------- ### Nginx Reverse Proxy with SSL for Kimai Source: https://www.kimai.org/documentation/webserver-configuration.html An Nginx configuration example for terminating SSL on a domain and forwarding requests to a Kimai application. This setup requires SSL certificates and specific proxy headers. ```nginx server { listen 443 ssl; server_name kimai2.local; ssl_certificate /etc/ssl/certs/kimai2.local.crt; ssl_certificate_key /etc/ssl/certs/kimai2.local.key; ssl_session_timeout 5m; ssl_protocols SSLv2 SSLv3 TLSv1; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; location / { proxy_pass http://127.0.0.1:8010/; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Host $host:$server_port; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Port $server_port; } # Redirect HTTP to HTTPS, in case an invalid (plain HTTP) request was sent to port 443 error_page 497 https://$host:$server_port$request_uri; } ``` -------------------------------- ### Install Kimai Database on Strato Source: https://www.kimai.org/documentation/shared-hosting.html This command initializes the Kimai database. Ensure you are in the Kimai directory and using the correct PHP CLI path. ```bash bin/console kimai:install -n ``` -------------------------------- ### Bootstrap Kimai Development Database Natively Source: https://www.kimai.org/documentation/developers.html Imports demo data and sets up the database schema for testing purposes in a native installation. This command is only available in the 'dev' environment. ```bash bin/console kimai:reset:dev ``` -------------------------------- ### Install Kimai Database on Plesk Source: https://www.kimai.org/documentation/shared-hosting.html Initialize the Kimai database using the console command. Ensure the correct PHP path is used. ```bash /opt/plesk/php/8.1/bin/php bin/console kimai:install -n ``` -------------------------------- ### Download and Verify Composer Installer Source: https://www.kimai.org/documentation/fresh-ubuntu-20.html Downloads the Composer installer script and verifies its integrity using a SHA384 hash. This step ensures the installer has not been tampered with. ```bash php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" ``` -------------------------------- ### Start MySQL Database with Docker Source: https://www.kimai.org/documentation/developers.html Runs a MySQL container for development. Use `host.docker.internal` to connect from the Kimai container if they are on the same Docker network. ```bash docker run --rm --name kimai-mysql-dev \ -e MYSQL_DATABASE=kimai \ -e MYSQL_USER=kimai \ -e MYSQL_PASSWORD=kimai \ -e MYSQL_ROOT_PASSWORD=kimai \ -p 3457:3306 -d mysql ``` -------------------------------- ### Kimai SAML Configuration Example Source: https://www.kimai.org/documentation/saml.html This YAML configuration sets up SAML authentication with Google as the provider. It includes attribute mapping for email, alias, and title, as well as role mapping for administrators and team leads. Ensure 'activate' is set to true to enable SAML. ```yaml kimai: saml: provider: google activate: true title: Login with SAML mapping: - { saml: $Email, kimai: email } - { saml: $FirstName $LastName, kimai: alias } - { saml: SAML User, kimai: title } roles: resetOnLogin: true attribute: Roles mapping: - { saml: Admin, kimai: ROLE_ADMIN } - { saml: Manager, kimai: ROLE_TEAMLEAD } ``` -------------------------------- ### Kimai Permission Configuration Example Source: https://www.kimai.org/documentation/permission-structure.html This snippet shows the structure for defining permission sets, maps, and roles in Kimai's configuration. It illustrates how to group permissions into sets, assign sets to roles, and add specific role permissions. ```yaml permissions: sets: TIMESHEET: ['view_own_timesheet', 'start_own_timesheet'] ACTIVITY: ['view_activity', 'create_activity'] PROFILE: ['my_profile', 'show_roles', 'other_profiles'] maps: ROLE_USER: ['TIMESHEET', 'ACTIVITY'] ROLE_ADMIN: ['TIMESHEET', 'ACTIVITY', 'PROFILE'] roles: ROLE_USER: ['my_profile'] ROLE_ADMIN: ['delete_activity'] ``` -------------------------------- ### Install Laminas LDAP Composer Package Source: https://www.kimai.org/documentation/ldap.html Install the required Laminas LDAP library using Composer. Ensure you use the optimize-autoloader and -n flags for faster installation. ```bash composer require laminas/laminas-ldap --optimize-autoloader -n ``` -------------------------------- ### Start MySQL Database Container Source: https://www.kimai.org/documentation/docker.html Runs a MySQL database container for Kimai testing. Data will be lost when the container is removed. Ensure the port mapping is correct. ```bash docker run --rm --name kimai-mysql-testing \ -e MYSQL_DATABASE=kimai \ -e MYSQL_USER=kimai \ -e MYSQL_PASSWORD=kimai \ -e MYSQL_ROOT_PASSWORD=kimai \ -p 3456:3306 -d mysql ``` -------------------------------- ### Troubleshoot 'flex.symfony.com not found' Error Source: https://www.kimai.org/documentation/updates.html If you encounter a 'curl error 6' during 'composer install', it indicates an old installation. Run composer install with additional flags and then follow the normal update process. ```bash composer install --no-dev --optimize-autoloader --no-plugins --no-scripts ``` -------------------------------- ### Full Kimai 1 Database Import Command Source: https://www.kimai.org/documentation/migration-v1.html A comprehensive example of the import command, including global settings for timezone, language, country, and currency, along with database connection details for Kimai 1. ```bash bin/console kimai:import:v1 --global --timezone="timezone" --language="language" --country="DE" --currency="EUR" --prefix="kimai1_" "mysql://user:password@127.0.0.1:3306/database?charset=utf8" "password" ``` -------------------------------- ### Create Kimai Database Source: https://www.kimai.org/documentation/fresh-ubuntu-18.html Connect to MySQL as root and create a dedicated database and user for Kimai. Ensure to use a strong password and consider changing the default username. ```bash sudo su mysql -u root ``` ```sql CREATE DATABASE IF NOT EXISTS `kimai2`; CREATE USER IF NOT EXISTS `kimai2`@127.0.0.1 IDENTIFIED BY "my-super-secret-password"; GRANT select,insert,update,delete,create,alter,drop,index,references ON `kimai2`.* TO kimai2@127.0.0.1; exit; ``` -------------------------------- ### Start OpenLDAP Service Source: https://www.kimai.org/documentation/ldap-example.html Start the OpenLDAP daemon (slapd) with debugging enabled and specifying the configuration file. ```bash /usr/libexec/slapd -d3 -f /opt/homebrew/etc/openldap/slapd.conf ``` -------------------------------- ### OpenLDAP User Attributes Query Example Source: https://www.kimai.org/documentation/ldap.html Example of a generated LDAP query to retrieve all attributes for a specific user. ```text SRCH base="uid=foo,ou=users,dc=kimai,dc=org" scope=2 deref=0 filter="(objectClass=*)" SRCH attr=+ * ``` -------------------------------- ### Configure Database Connection Source: https://www.kimai.org/documentation/shared-hosting.html Example of a database connection string for Kimai, specifying the database type, user, password, host, port, database name, character set, and server version. ```ini DATABASE_URL=mysql://user:pwd@yourDbServer.manitu.net:3306/YourDbName?charset=utf8mb4&serverVersion=10.11.4-MariaDB-log ``` -------------------------------- ### Install PHP 8.3 Source: https://www.kimai.org/documentation/fresh-ubuntu-22.html Installs PHP 8.3 along with common extensions required for web applications like Kimai. ```bash apt-get install php8.3 php8.3-curl php8.3-fpm php8.3-gd php8.3-intl php8.3-mbstring php8.3-mysql php8.3-opcache php8.3-xml php8.3-zip ``` -------------------------------- ### Configure .env file Source: https://www.kimai.org/documentation/shared-hosting.html Opens the .env file for configuration using the nano text editor. This file contains essential application settings. ```bash nano .env ``` -------------------------------- ### Install PHP 8.1 and Extensions Source: https://www.kimai.org/documentation/fresh-ubuntu-20.html Installs PHP 8.1 core components and common extensions required for web applications. ```bash apt install php8.1-cli php8.1-common php8.1-curl php8.1-fpm php8.1-gd php8.1-intl php8.1-mbstring php8.1-mysql php8.1-opcache php8.1-readline php8.1-xml php8.1-zip ``` -------------------------------- ### Install PHP Dependencies with Composer Source: https://www.kimai.org/documentation/installation.html Install all necessary PHP dependencies using Composer. This command optimizes the autoloader for production environments. ```bash composer install --no-dev --optimize-autoloader ``` -------------------------------- ### Add Ondřej PHP PPA Source: https://www.kimai.org/documentation/fresh-ubuntu-20.html Installs software-properties-common and adds the Ondřej PHP PPA repository to enable installation of PHP 8.1. ```bash apt install software-properties-common add-apt-repository ppa:ondrej/php ``` -------------------------------- ### Example Kimai Settings in local.yaml Source: https://www.kimai.org/documentation/local-yaml.html This snippet shows how to configure Kimai's timesheet rounding settings by adding them to your `local.yaml` file. This file should be created by you and will override default configurations. ```yaml kimai: timesheet: rounding: default: begin: 15 end: 15 ``` -------------------------------- ### Create First Kimai User via Command Line Source: https://www.kimai.org/documentation/installation.html Create a new user with a specified username, email, and role using the Kimai console command. The first user created is automatically assigned the ROLE_SUPER_ADMIN. ```bash bin/console kimai:user:create username admin@example.com ROLE_SUPER_ADMIN ``` -------------------------------- ### Clockify Date Parsing Error Example Source: https://www.kimai.org/documentation/plugin-import.html An example of a date parsing error that can occur if the date format is incorrect when importing from Clockify. ```text Failed to parse time string (14/04/2023 9:00) at position 0 (1): Unexpected character ``` -------------------------------- ### Create Kimai Database and User Source: https://www.kimai.org/documentation/fresh-ubuntu-22.html Creates a new database named 'kimai' and a user 'kimai' with a specified password, granting all necessary privileges on the 'kimai' database. ```sql CREATE DATABASE IF NOT EXISTS `kimai`; CREATE USER IF NOT EXISTS `kimai`@127.0.0.1 IDENTIFIED BY "my-super-secret-password"; GRANT select,insert,update,delete,create,alter,drop,index,references ON `kimai`.* TO kimai@127.0.0.1; ```