Have you always wanted to have a beautiful insight into and control over your finances? You now have the chance to track your finances, and keep an eye on your money without having to upload your financial records to the cloud. Firefly III works on the principle that if you know where your money is going, you can stop it from going there. Now you have an idea of what Firefly III is.

To make it clear, “Firefly III” is a (self-hosted) manager for your personal finances. It can help you keep track of your expenses and income, so you can spend less and save more. Firefly III supports the use of budgets, categories and tags. It can import data from external sources and it has many neat financial reports available.

Features of Firefly III Personal Finance Manager

  • Create recurring transactions to manage your money
  • Rule based transaction handling with the ability to create your own rules
  • Import data from external systems
  • A double-entry bookkeeping system
  • Save towards a goal using piggy banks
  • View income and expense reports
  • 2 factor authentication for extra security 🔒
  • Supports any currency you want, including crypto currencies such as ₿itcoin and Ξthereum
  • There is a Docker image and an Heroku script.
  • Clear views that should show you how you’re doing
  • Easy navigation through your records
  • Lots of charts because we all love them

Firefly III Personal Finance Manager Setup requirements

  • Install a LAMP | LEMP stack
  • PHP 7.3 and some modules
  • composer

“Opportunities come infrequently. When it rains gold, put out the bucket, not the thimble”

Warren Buffett

Step 1: Update and upgrade your server

Once in the terminal of your fresh Ubuntu server, update and upgrade it and install essential tools we shall use.

sudo apt update && sudo apt upgrade
sudo apt install vim git nginx curl -y

Step 2: Install and setup LEMP Stack

As you can guess, Firefly III requires a webserver, a database and since it is written in PHP, we will have to get it installed as well.

Install and configure a webserver and PHP

Here, you have the freedom of either picking Apache or Nginx. We shall use Nginx for this guide. Additionally, we shall use PHP Version 7.3 as required.

Install php-fpm and dependencies

sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install -y php7.3 php7.3-{cli,zip,gd,fpm,json,common,mysql,zip,mbstring,curl,xml,pear,bcmath,imap,ldap,intl}

Check if php-fpm is running.

$ sudo systemctl status php7.3-fpm
● php7.3-fpm.service - The PHP 7.3 FastCGI Process Manager
     Loaded: loaded (/lib/systemd/system/php7.3-fpm.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2020-07-13 13:27:53 EAT; 2min 12s ago
       Docs: man:php-fpm7.3(8)
    Process: 97804 ExecStartPost=/usr/lib/php/php-fpm-socket-helper install /run/php/php-fpm.sock /etc/php/7.3/fpm/pool.d/www.conf 73 (code=exi>   Main PID: 97791 (php-fpm7.3)
     Status: "Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req/sec"
      Tasks: 3 (limit: 1035)
     Memory: 10.7M
     CGroup: /system.slice/php7.3-fpm.service
             ├─97791 php-fpm: master process (/etc/php/7.3/fpm/php-fpm.conf)
             ├─97802 php-fpm: pool www
             └─97803 php-fpm: pool www

Add recommemded PHP Settings

Open up your php-fpm ini file and add/edit the details shown below. They include Timezone, and memory limit settings. Add your date.timezone (at about line 955) and change memory_limit (at about line 400) to 512MB.

$ sudo vim /etc/php/7.3/fpm/php.ini
memory_limit = 512M

[Date]
date.timezone = Africa/Nairobi

Stop and disable Apache

Apache tugs along when installing PHP in Ubuntu. If you do not intend using it, stop it and disable it.

sudo systemctl stop apache2
sudo systemctl disable apache2

Configure Nginx web server

We have to make a few changes to the Nginx configuration defaults by adding the details we need for Mautic. Change into sites-enabled, back up the default file and create a new one having new configurations.

cd /etc/nginx/sites-enabled/
sudo mv default{,.bak}

Create a new file and add the details shown below. If you have an FQDN, replace example.com with it.

$ sudo vim /etc/nginx/sites-enabled/firefly.conf

server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  example.com;
        root         /var/www/html/firefly-iii/public;
        index index.html index.htm index.php;

        location / {
                try_files $uri /index.php$is_args$args;
        }

        location ~ .php$ {
        fastcgi_pass unix:/run/php/php7.3-fpm.sock;
        fastcgi_index index.php;
        fastcgi_read_timeout 240;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
        fastcgi_split_path_info ^(. .php)(/. )$;
        }
    }

After your configurations are solid, restart php-fpm and nginx

sudo systemctl restart nginx php7.3-fpm

Install and configure MariaDB Database Server

We are going to use MariaDB for this setup. Fortunately, we have a detailed guide already to get MariaDB 10.5 installed. Check out How To Install MariaDB 10 on Ubuntu

After you have the database installed, the next step is to create a database and user for Firefly III. Let us therefore go ahead and get this done as shown below. You are free to name your database and user differently and ensure you use a safe password.

$ mysql -u root -p

CREATE DATABASE firefly_database;
CREATE USER 'fireflyuser'@'localhost' IDENTIFIED BY 'StrongPassword';
GRANT ALL PRIVILEGES ON firefly_database. * TO 'fireflyuser'@'localhost';
FLUSH PRIVILEGES;
exit;

That was easy and amazingly fast.

Step 3: Install PHP Composer

Composer is required to in order to get Mautic’s dependencies installed. Do the following to setup composer

cd ~
curl -sS https://getcomposer.org/installer -o composer-setup.php
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer

Test if composer is successfully installed by running the composer command

$ composer -V
Composer version 1.10.8 2020-06-24 21:23:30

Step 4: Install Firefly III on Ubuntu 20.04 | 18.04

After composer is installed, change into the directory that will hold the root files as configured in Nginx above and run the composer command below. The last number is the latest version number and can be ommitted.

cd /var/www/html/
composer create-project grumpydictator/firefly-iii --no-dev --prefer-dist firefly-iii 5.2.8  ##This might take some time to complete!

While within the same directory, fix the access rights of the new files

sudo chown -R www-data:www-data firefly-iii
sudo chmod -R 775 firefly-iii/storage

Step 5: Configure Firefly III on Ubuntu 20.04 | 18.04

In the firefly-iii directory you will find a .env file. Open this file using your favorite editor and make the following database-related changes as directed by the instructions provided therein. The database and username are the same ones we set un on Step 2.

$ sudo vim /var/www/html/firefly-iii/.env

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=firefly_database
DB_USERNAME=fireflyuser
DB_PASSWORD=StrongPassword

Check the screenshot below as well.

Note that the .env file has Mail settings too if you would wish Firefly III to mail you.

Initialize the database

This step is very important, because Firefly III needs a database to work with and it will tell you whether or not your configuration is correct. Run the following command in the Firefly III directory.

cd /var/www/html/firefly-iii

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

Setup logrotate

Logrotate will help you manage the logs efficiently by making sure they are compressed and rotated well. There shouldn’t be any harm using logrotate for Firefly III logs.

sudo vim /etc/logrotate.d/firefly-iii

##Example config:

/opt/firefly-iii/storage/logs/*.log
{
    weekly
    missingok
    rotate 2
    compress
    notifempty
    sharedscripts
    maxage 60
}

Step 6: Accessing Firefly III on Ubuntu 20.04 | 18.04

You now are able to access Firefly III web interface by browsing to site http://domain-name-or-password/. You should see a login screen but you cannot log in yet. Click on “Register a new account” and fill in the form. The password must be at least 16 characters.

<img alt="" data-ezsrc="https://kirelos.com/wp-content/uploads/2020/07/echo/Firefly-login-page.png" data-ez ezimgfmt="rs rscb8 src ng ngcb8 srcset" src="data:image/svg xml,”>

You will be logged in automatically. Follow the instructions and you are done!

<img alt="" data-ezsrc="https://kirelos.com/wp-content/uploads/2020/07/echo/Firefly-first-page-1024×531.png" data-ez ezimgfmt="rs rscb8 src ng ngcb8 srcset" height="474" src="data:image/svg xml,” width=”916″>

Now you are ready to create budgets, track your expenses, track your savings and become a better person. It has so much precious tools one can leverage on.

<img alt="" data-ezsrc="https://kirelos.com/wp-content/uploads/2020/07/echo/Firefly-dashboard-after-submitting-cash-details-1024×529.png" data-ez ezimgfmt="rs rscb8 src ng ngcb8 srcset" height="485" src="data:image/svg xml,” width=”940″>

Our personal maoney manager should enable us soar to greater heights now that it is within our reach. Firefly III is an amazing software and you should get it installed for your personal use. You will definitely enjoy it. Thanks to the developer(s) and the contributors. Wonderful work!! To end this session, we would wish to thank you for visiting and staying till the end.

Other people also read:

How To Install Invoice Ninja on CentOS 8

Best Books to learn Web Development – PHP, HTML, CSS, JavaScript and jQuery

How To Install Odoo 13 on Ubuntu