Skip to content

Instantly share code, notes, and snippets.

@Engr-AllanG
Last active March 4, 2024 12:42
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save Engr-AllanG/34e77a08e1482284763fff429cdd92fa to your computer and use it in GitHub Desktop.
Save Engr-AllanG/34e77a08e1482284763fff429cdd92fa to your computer and use it in GitHub Desktop.
Firefly-III Ubuntu 20.04 Proxmox Installation Guide

This is a summarized guide I created while installing Firefly-III in a Proxmox (6.2-15) container running Ubuntu 20.04.

I followed this tutorial. It has a link to this other tutorial for installing mariaDB. Furthermore, the official Firefly-iii documentation is Here

This guide has everything I did in one concise summary. Not much is explained. This will take about 1.5 hrs.

Note: I initially followed the official instructions and used a LAMP stack. I had issues with apache and getting the webserver to work (likely because I am not familiar with apache and am more comfortable with nginx).

To begin, first read through the two tutorials and official documentation so that you hav an idea of whats going on

Container

First, create a 20.04 privileged container with 1 core,  512 mb ram, and default 8GB hard disk space. CT 128 with IP 192.168.1.128

Installation Instructions

Did I mention to first read through the two tutorials and official documentation?

Prep

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

Check to see if php is running

 php -v and systemctl status php7.4-fpm

Adjust some php settings

nano /etc/php/7.4/fpm/php.ini

use ctrl-w to search for and change or enable the following lines of code

memory_limit = 512M

[Date]
date.timezone = America/Los_Angeles

stop apache

systemctl stop apache2
systemctl disable apache2

backup nginx file

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

create firefly.conf in sites-enabled folder and then paste in the config below

nano /etc/nginx/sites-enabled/firefly.conf

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

        location / {
                try_files $uri /index.php$is_args$args;
                autoindex on;
                sendfile off;
       }

        location ~ \.php$ {
        fastcgi_pass unix:/run/php/php7.4-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)(/.+)$;
        }

    }

restart

systemctl restart nginx php7.4-fpm

If you get an error due to duplicate web servers, you need to remove the symbolic link in sites-available (ls -l) and then rm the link

Install mariaDB

apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
add-apt-repository 'deb [arch=amd64] http://mariadb.mirror.globo.tech/repo/10.5/ubuntu focal main'
apt update
apt install mariadb-server mariadb-client
mysql_secure_installation

test installation

mysql -u root -p

in the mysql shell, check version with the command in bold

MariaDB [(none)]> SELECT VERSION();

while still inside the mariaDB shell:

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

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

test composer

composer -V

install firefly - change the version number at the end of the command below to whatever the latest is

cd /var/www/html/
composer create-project grumpydictator/firefly-iii --no-dev --prefer-dist firefly-iii 5.4.6

cd /var/www/html/firefly-iii
php artisan migrate:refresh --seed
php artisan firefly-iii:upgrade-database
php artisan passport:install

Make sure we have the right locale enabled (currency and language?) 

First check to see what is enabled. I want (en_US.utf8, en_US.UTF-8)

locale -a

nano /etc/locale.gen and uncomment the line en_US.utf8, en_US.UTF-8 

locale-gen
systemctl restart nginx php7.4-fpm

That should be it. Navigate to the container IP address and you should get firefly Login

@WojtekK78
Copy link

Before running php artisan migrate:refresh --seed please make sure to update /var/www/html/firefly-iii/.env following section to:
DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=firefly_db DB_USERNAME=fireflyuser DB_PASSWORD=yourpasswordhere

Or accordingly to your changes

Copy link

ghost commented Aug 24, 2021

When I run

root@firefly:/etc/nginx/sites-enabled# systemctl restart nginx php7.4-fpm

I get the error:

Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.
Aug 24 19:41:06 firefly systemd[1]: Starting A high performance web server and a reverse proxy server...
Aug 24 19:41:06 firefly nginx[30213]: nginx: [emerg] open() "/etc/nginx/sites-enabled/default.bak" failed (2: No such file or directory) in /etc/nginx/nginx.conf:62
Aug 24 19:41:06 firefly nginx[30213]: nginx: configuration file /etc/nginx/nginx.conf test failed
Aug 24 19:41:06 firefly systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Aug 24 19:41:06 firefly systemd[1]: nginx.service: Failed with result 'exit-code'.
Aug 24 19:41:06 firefly systemd[1]: Failed to start A high performance web server and a reverse proxy server.

Proxmox 6.4-6
CT: Ubuntu 20.04

@MichalRybecky
Copy link

MichalRybecky commented Sep 7, 2021

@WonderingDane, I had the same problem, removing (or moving to e.g. home folder) the default.bak symlink inside /etc/nginx/sites-enabled/ got it working.

However, I am unable to view the web page after successful install. I have followed every step (only 1 "error" after php artisan passport:install that says Encryption keys already exist. Use the --force option to overwrite them.), but when navigating to my LXC IP address in web browser, the page loads immediately with favicon working, Screenshot here. I am using exactly the same setup-Ubuntu 20.04 LXC inside Proxmox.

Any thoughts?

@Megatron36
Copy link

MichalRybecky, I was having the same problem as you I figured out what was left out by looking at the other guide. you need to do the following:

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

@MichalRybecky
Copy link

@Megatron36 thank you, works like a charm.

@Engr-AllanG
Copy link
Author

All, thanks for your comments on the errors you found. I haven't had a chance to update the guide, but I wanted to comment that I saw you all found some issues.

Thanks!

@EmmanuelMess
Copy link

This doesn't work for the latest version of firefly iii because it uses php8.0 I think.

@EmmanuelMess
Copy link

It seems it doesn't follow softlinks, I had softlinked the folder firefly-iii and nothing showed up, actually moving the folder and resetting ownership worked.

@ph1lsen
Copy link

ph1lsen commented Dec 6, 2021

Hey there,

I've updated your PHP Install Command for the newest version:
apt install -y php8.0 php8.0-{cli,zip,gd,fpm,common,mysql,mbstring,curl,xml,bcmath,imap,ldap,intl}

You also had zip in there 2times and the json package always threw me an error. Leaving it out of it worked fine.

@gathurian
Copy link

Got an Error 502 as well, until I updated /etc/nginx/sites-enabled/firefly.conf - You need to replace fastcgi_pass unix:/run/php/php7.4-fpm.sock; with fastcgi_pass unix:/run/php/php8.0-fpm.sock; (or whatever version of PHP you have installed)

@gruentee
Copy link

gruentee commented Jun 3, 2022

There's a typo - i.e. extra whitespace - in the SQL statement for granting privileges to fireflyuser:
It shoul read

GRANT ALL PRIVILEGES ON firefly_db.* TO 'fireflyuser'@'localhost';

instead of firefly_db. *.

EDIT:
One can also simplify the two statements into one:

--- omit CREATE USER
GRANT ALL PRIVILEGES ON firefly_db.* TO 'fireflyuser'@'localhost' IDENTIFIED BY 'my$3cur3P4ssw0rD';

@gruentee
Copy link

gruentee commented Jun 3, 2022

First, create a 20.04 privileged container

Also, could you explain why you would need a privileged container? It opens up an unnecessary security hole IMHO.

@gruentee
Copy link

I have to more comments:

  1. As all files in /etc/nginx/sites-enabled/ are supposed to be symlinks to /etc/nginx/sites-available (to be able to conveniently enable/disable sites without moving/deleting files) I wouldn't backup the default site into this folder but rather in sites-available
  2. Same goes for creating the new Firefly site: create it in sites-available and symlink to it in sites-enabled

@Engr-AllanG
Copy link
Author

First, create a 20.04 privileged container

Also, could you explain why you would need a privileged container? It opens up an unnecessary security hole IMHO.

I have not been active on github in quite sometime. Similarly, I can't remember why the container needed to be privileged. I checked my notes as well and I did not write myself an explanation.

@Engr-AllanG
Copy link
Author

I have to more comments:

  1. As all files in /etc/nginx/sites-enabled/ are supposed to be symlinks to /etc/nginx/sites-available (to be able to conveniently enable/disable sites without moving/deleting files) I wouldn't backup the default site into this folder but rather in sites-available
  2. Same goes for creating the new Firefly site: create it in sites-available and symlink to it in sites-enabled

I agree

@Engr-AllanG
Copy link
Author

I have not been active on github in quite sometime. I am happy to see many of you have found some mistakes and improved this guide for others to use

@okothmax
Copy link

Screenshot (6)

I'm getting this error when I run:
php artisan migrate:refresh --seed

@gruentee
Copy link

Screenshot (6)

I'm getting this error when I run: php artisan migrate:refresh --seed

Looks like you're having some network trouble there, more specifically your computer can't resolve the database servers' IP address by its DNS name. I suggest entering the IP address instead.

@mrreview
Copy link

mrreview commented Jul 24, 2023

First, create a 20.04 privileged container

Also, could you explain why you would need a privileged container? It opens up an unnecessary security hole IMHO.

There's no need to create a privileged container. I'm running firefly without any issues on an unprivileged container.

@klyptonic
Copy link

Hey there,

I've updated your PHP Install Command for the newest version: apt install -y php8.0 php8.0-{cli,zip,gd,fpm,common,mysql,mbstring,curl,xml,bcmath,imap,ldap,intl}

You also had zip in there 2times and the json package always threw me an error. Leaving it out of it worked fine.

Using your help I ran into the same problem with 8.0...using the latest 8.3 instead helped:
apt install -y php8.3 php8.3-{cli,zip,gd,fpm,common,mysql,mbstring,curl,xml,bcmath,imap,ldap,intl}

If anyone else runs into this problem with later releases of Firefly-III, refer here to see the requirement for PHP:
https://packagist.org/packages/grumpydictator/firefly-iii

@lyett
Copy link

lyett commented Feb 7, 2024

Only use Ubuntu & versions supporting PHP 8.3. See this link
Prerequisites

Could not get it to work on Debian or another proxmox template stack. However, worked on Ubuntu 22.04. Ubuntu 23.10 will not work, at the time of writing this - as per the Prerequisites link above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment