InvoicePlane is a free and open-source invoicing application. This guide will walk you through the installation process on a FreeBSD 12 system using Nginx.
Requirements
- Web Server: Nginx (this tutorial uses Nginx).
- MySQL version 5.5 or greater, or MariaDB equivalent.
- PHP version 7.0, 7.1, or 7.2 with the following extensions:
- php-gd
- php-hash
- php-json
- php-mbstring
- php-mcrypt
- php-mysqli
- php-openssl
- php-recode
- php-xmlrpc
- php-zlib
Prerequisites
- A server running FreeBSD 12.
- A non-root user with sudo privileges.
Initial Steps
Verify your FreeBSD version:
uname -ro # FreeBSD 12.1-RELEASE
Set the timezone:
tzsetup
Update your operating system packages for the latest updates and security fixes:
freebsd-update fetch install pkg update && pkg upgrade -y
Install essential administration packages for FreeBSD 12.0:
pkg install -y sudo vim unzip wget bash
Step 1 – Install PHP and Required Extensions
InvoicePlane requires PHP version 7.0 or greater. Install PHP and necessary extensions:
sudo pkg install -y php72 php72-ctype php72-curl php72-dom php72-hash php72-iconv php72-gd php72-json php72-mbstring php72-openssl php72-session php72-simplexml php72-xml php72-zip php72-zlib php72-pdo php72-pdo_mysql php72-mysqli php72-filter php72-ftp php72-tokenizer php72-calendar php72-pecl-APCu php72-opcache
Verify the PHP version:
php --version # PHP 7.2.7 (cli) (built: Jul 25 2019 01:28:53) ( NTS ) # Copyright (c) 1997-2018 The PHP Group # Zend Engine v3.3.7, Copyright (c) 1998-2018 Zend Technologies # with Zend OPcache v7.3.7, Copyright (c) 1999-2018, by Zend Technologies
Enable and start PHP-FPM service:
sudo sysrc php_fpm_enable=yes sudo service php-fpm start
Step 2 – Install MySQL
Install MySQL database server:
sudo pkg install -y mysql57-server
Verify MySQL version:
mysql --version # mysql Ver 14.14 Distrib 5.7.26, for FreeBSD12.0 (amd64) using EditLine wrapper
Enable and start MySQL service:
sudo sysrc mysql_enable="yes" sudo service mysql-server start
Run mysql_secure_installation
to secure MySQL and set a password for the root user:
sudo mysql_secure_installation
Respond to the prompts as follows:
Would you like to setup VALIDATE PASSWORD plugin? N New password: your_secure_password Re-enter new password: your_secure_password Remove anonymous users? [Y/n] Y Disallow root login remotely? [Y/n] Y Remove test database and access to it? [Y/n] Y Reload privilege tables now? [Y/n] Y
Connect to MySQL shell as root:
sudo mysql -u root -p # Enter password
Create a database and user for InvoicePlane:
CREATE DATABASE dbname; CREATE USER 'username'@'localhost' IDENTIFIED BY 'password'; GRANT ALL ON dbname.* TO 'username'; FLUSH PRIVILEGES;
Exit MySQL:
exit
Note: Replace dbname
, username
, and password
with your own values.
Step 3 – Install acme.sh and Obtain Let’s Encrypt Certificate (Optional)
Securing your website with HTTPS is a recommended practice. We will use Acme.sh to get a Let’s Encrypt TLS certificate.
Install Acme.sh:
sudo pkg install -y acme.sh
Check Acme.sh version:
acme.sh --version # v2.8.2
Obtain RSA and ECC/ECDSA certificates for your domain:
# RSA sudo acme.sh --issue --standalone --home /etc/letsencrypt -d example.com --keylength 2048 # ECDSA sudo acme.sh --issue --standalone --home /etc/letsencrypt -d example.com --keylength ec-256
Your certificates and keys will be located in:
- For RSA:
/etc/letsencrypt/example.com
- For ECC/ECDSA:
/etc/letsencrypt/example.com_ecc
Step 4 – Install NGINX
Install the NGINX web server:
sudo pkg install -y nginx
Check NGINX version:
nginx -v # nginx version: nginx/1.14.2
Enable and start NGINX service:
sudo sysrc nginx_enable=yes sudo service nginx start
Configure Nginx for InvoicePlane:
sudo vim /usr/local/etc/nginx/invoiceplane.conf
Add the following configuration:
server {
listen 80;
listen [::]:80;
server_name example.com;
root /usr/local/www/invoiceplane;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~* \.php$ {
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_index index.php5;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
Test the NGINX configuration:
sudo nginx -t
Reload NGINX:
sudo service nginx restart
Step 5 – Install InvoicePlane
Download the latest stable version of InvoicePlane:
sudo mkdir -p /usr/local/www cd /usr/local/www sudo curl -O -J -L https://invoiceplane.com/download/v1.5.9 sudo unzip v1.5.9.zip sudo rm v1.5.9.zip sudo mv ip invoiceplane
Navigate to the InvoicePlane directory:
cd /usr/local/www/invoiceplane
Copy the example configuration file:
sudo cp ipconfig.php.example ipconfig.php
Edit the ipconfig.php
file and set your URL:
sudo vim ipconfig.php # Example: IP_URL=http://example.com
Change ownership of the InvoicePlane directory:
sudo chown -R www:www /usr/local/www/invoiceplane
Edit PHP settings to set the timezone:
sudo vim /etc/php.ini
Find and set:
date.timezone = Region/City
Restart the PHP-FPM service:
sudo service php-fpm restart
Access the InvoicePlane installer in your browser:
http://example.com/index.php/setup
Once installation completes, log into InvoicePlane with the chosen credentials.
To secure your installation, disable the setup:
Edit ipconfig.php
and change:
DISABLE_SETUP=false to DISABLE_SETUP=true
Finalize InvoicePlane Setup
Access the web installation wizard by visiting http://example.com in your browser. Follow the setup prompts:
Links
FAQ
What is InvoicePlane?
InvoicePlane is an open-source application designed to help manage invoices, clients, and payments seamlessly.
Can I use Apache instead of Nginx?
Yes, InvoicePlane supports Apache web server as well, although this tutorial specifically covers Nginx.
Is HTTPS mandatory for InvoicePlane?
While not mandatory, securing your site with HTTPS is highly recommended to protect data transmission.