Install Firefly III on Linux

Table of Contents
Requirements #
PHP 8.4 #
Firefly III requires PHP 8.4.
See here how to install the latest PHP.
apt
#
Install the required packages:
apt install php-fpm php-bcmath php-intl php-curl php-zip php-sodium php-gd php-xml php-mbstring php-mysql mariadb-server nginx jq
Source Code #
The following command sets the FIREFLY_VERSION
to the latest stable version of Firefly III:
export FIREFLY_VERSION="$(wget -q -O- 'https://api.github.com/repos/firefly-iii/firefly-iii/releases/latest' | jq -r '.tag_name')"
Download the archive:
wget "https://github.com/firefly-iii/firefly-iii/releases/download/$FIREFLY_VERSION/FireflyIII-$FIREFLY_VERSION.tar.gz"
Download the checksum:
wget "https://github.com/firefly-iii/firefly-iii/releases/download/$FIREFLY_VERSION/FireflyIII-$FIREFLY_VERSION.tar.gz.sha256"
Check the downloaded archive:
sha256sum -c "FireflyIII-$FIREFLY_VERSION.tar.gz.sha256"
MariaDB #
Setup a new database and user:
mysql_secure_installation
export MYSQL_PASSWD="$(tr -dc A-Za-z0-9 </dev/urandom | head -c 16; echo)"
mysql --execute="CREATE DATABASE firefly; CREATE USER 'firefly'@'localhost' IDENTIFIED BY '${MYSQL_PASSWD}'; GRANT ALL PRIVILEGES ON firefly.* TO 'firefly'@'localhost'; FLUSH PRIVILEGES;"
Install #
Create the folder for Firefly III:
mkdir /var/www/firefly
Extract the downloaded tar archive:
tar -xvf "FireflyIII-$FIREFLY_VERSION.tar.gz" -C /var/www/firefly/
Create the .env
file:
cp /var/www/firefly/.env.example /var/www/firefly/.env
Change the owner of the files:
chown -R www-data:www-data /var/www/firefly
Set the correct permission:
chmod -R 0775 /var/www/firefly
Configure #
nano /var/www/firefly/.env
Initialize the database #
sudo -u www-data /usr/bin/php /var/www/firefly/artisan firefly-iii:upgrade-database
sudo -u www-data /usr/bin/php /var/www/firefly/artisan firefly-iii:correct-database
sudo -u www-data /usr/bin/php /var/www/firefly/artisan firefly-iii:report-integrity
sudo -u www-data /usr/bin/php /var/www/firefly/artisan firefly-iii:laravel-passport-keys
Nginx #
Configuration example for nginx:
server {
listen 80;
server_name firefly.example.com;
# Set root path
root /var/www/firefly/public;
index index.php;
location / {
try_files $uri $uri/ /index.php?$args;
}
# Set FastCGI
location ~ \.php$ {
include snippets/fastcgi-php.conf;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
fastcgi_pass unix:/var/run/php/php-fpm.sock;
}
# Disable accessing hidden files except .well-known
location ~ /\.(?!well-known).* {
deny all;
}
}
Cron jobs #
After the registration, create the cron job:
crontab -u www-data -e
0 3 * * * /usr/bin/php /var/www/firefly/artisan firefly-iii:cron