“Firefly III” is a (self-hosted) manager for your personal finances. You can find more about it on the following sites:

Install prerequisites

Let’s first install the requirements to run Firefly. Firefly documentation says it runs on PHP 7.2 but that’s wrong, it needs >=7.3 . Unfortunately, Ubuntu 19.04 comes with PHP 7.2 by default, so we need to use a PPA to have a more recent version.

ondrej/php PPA has version 7.4 at this time, that will be perfect.

Firefly needs a database, I have chosen to go with PostgreSQL.

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.4 php7.4-bcmath php7.4-curl php7.4-gd php7.4-intl php7.4-ldap php7.4-mbstring php7.4-xml php7.4-zip unzip postgresql php7.4-pgsql
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer 

Install Firefly

To retrieve Firefly, it’s quite simple. Go to https://version.firefly-iii.org/ , choose the version you want and mention it in the command below. For me, I have chosen the latest stable version at this time: 4.8.2 .

$ composer create-project grumpydictator/firefly-iii --no-dev --prefer-dist firefly-iii 4.8.2
$ sudo chown -R www-data:www-data firefly-iii
$ sudo chmod -R 775 firefly-iii/storage/
$ mv firefly-iii /var/www 

Configure PostgreSQL

su - postgres
psql
postgres=# create database firefly;
postgres=# create role firefly with login encrypted password 'secret_firefly_password';
postgres=# exit 

You can test the connection is working using the following command. It will prompt for your password.

psql -U firefly -W firefly 

If all goes well, you should obtain the following prompt:

firefly=> 

Configure Firefly

Edit the file .env at the root of firefly-iii directory. You may want to change the following variables:

APP_ENV=production
SITE_OWNER=your email address
TZ=your timezone
APP_URL=http://youripaddress/firefly-iii 

You need to use a database for Firefly. I have chosen to use PostgreSQL.

# Database credentials. Make sure the database exists. I recommend a dedicated user for Firefly III
# For other database types, please see the FAQ: https://docs.firefly-iii.org/support/faq
DB_CONNECTION=pgsql
DB_HOST=localhost
DB_PORT=5432
DB_DATABASE=firefly
DB_USERNAME=firefly
DB_PASSWORD=secret_firefly_password 

If you want Firefly to send emails, you need to change the following variables:

# If you want Firefly III to mail you, update these settings
# For instructions, see: https://docs.firefly-iii.org/advanced-installation/email
MAIL_DRIVER=log
MAIL_HOST=your mail server here
MAIL_PORT=25
MAIL_FROM=your@email.address
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null 

Once you are done, you can initialize the database:

php artisan migrate:refresh --seed
php artisan firefly-iii:upgrade-database
php artisan passport:install 

Configure Apache

I have chosen to stick with Apache2 to run Firefly, so let’s configure it.

By default, Apache2 serves files under /var/www/html but we have moved firefly-iii directory under /var/www . Moreover, we must only present public/ directory .

In addition, Firefly uses .htaccess file inside public/ directory, but default configuration of Apache2 denies it. So we need to allow this.

Let’s edit file /etc/apache2/sites-available/000-default.conf to configure all of the above. Put the following code inside block:

Alias /firefly-iii /var/www/firefly-iii-4.8.2/public
<Directory /var/www/firefly-iii/public>
    AllowOverride FileInfo Options=Indexes,MultiViews
</Directory> 

In addition, Firefly rewrites URL so we need to enable Apache2 module.

sudo a2enmod rewrite 

Then restart Apache2:

sudo systemctl restart apache2