Runs at 10.1.1.27
on Ubuntu 20.04.
apt install git unzip curl mariadb-server mariadb-client nginx software-properties-common
add-apt-repository ppa:ondrej/php
apt install php8.1-fpm php8.1-cli php8.1-common php8.1-opcache php8.1-readline php8.1-xml php8.1-zip php8.1-intl php8.1-gd php8.1-mbstring php8.1-mysql php8.1-curl
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;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
chmod +x composer.phar
mv composer.phar /usr/bin/composer
mysql -u root
# CREATE DATABASE IF NOT EXISTS `kimai2`;
# CREATE USER IF NOT EXISTS `kimai2`@127.0.0.1 IDENTIFIED BY "<pw>";
# GRANT select,insert,update,delete,create,alter,drop,index,references ON `kimai2`.* TO kimai2@127.0.0.1;
# exit;
cd /var/www/
rm -rf html
git clone -b 1.17.1 --depth 1 https://github.com/kevinpapst/kimai2.git
cd kimai2/
composer install --no-dev --optimize-autoloader -n
nano .env
# DATABASE_URL=mysql://kimai2:<pw>@127.0.0.1:3306/kimai2?charset=utf8&serverVersion=5.7
# MAILER_FROM=kimai@<domain>
# MAILER_URL=mailgun+api://<key>:<domain>@default
# APP_SECRET=<secret>
# TRUSTED_PROXIES=127.0.0.1,10.1.1.12
# TRUSTED_HOSTS=localhost,<public_url>
bin/console kimai:install -n
bin/console kimai:user:create <username> <email> ROLE_SUPER_ADMIN
chown -R :www-data .
chmod -R g+r .
chmod -R g+rw var/
chmod -R g+rw public/avatars/
# Copy from below.
nano /etc/nginx/sites-available/kimai2
unlink /etc/nginx/sites-enabled/default
ln -s /etc/nginx/sites-available/kimai2 /etc/nginx/sites-enabled/kimai2
nginx -t && service nginx reload
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name www.kimai.local;
root /var/www/kimai2/public;
index index.php;
access_log off;
log_not_found off;
location ~ /\.ht {
deny all;
}
location / {
try_files $uri /index.php$is_args$args;
}
location ~ ^/index\.php(/|$) {
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi.conf;
fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/..:/tmp/";
internal;
}
location ~ \.php$ {
return 404;
}
}