Invoice Ninja is a free and open source application used for generating invoices, managing payments, tracking expenses, time and tasks tracking and much more. The application is written in PHP and requires a web server such as Nginx or Apache httpd for serving its web content. This tool enables you to create and send invoices to clients in seconds after installation. It is designed to be highly customizable which means it is easy to integrate with your consultancy business, service offering website or for E-Commerce platforms.
In this article I’ll walk you through the installation of Invoice Ninja on CentOS 8 Linux server. Some of the cool features of Invoice Ninja are:
- Create Recurring Invoicing & Auto-Bill Clients
- Alerts When Client Views & Pays Invoices
- Email Invoices & Accept Payments Online
- Accept Deposits & Partial Payments
- Password Protect Client-Side Portals
- Attach Invoice .PDFs to Emails
- Customize Invoices With Your Company Logo
- Create Project Tasks & Track Time Online
- Create Quotations & Pro-Forma Invoices
- Invoice Payment Auto-Reminder Emails
- Tax Settings per Item or Invoice Total
- Professional Invoice Template Design
- Quotes Convert to Invoices for Payment
- e.t.c
Some features are only available as commercial offerings. These includes:
- Fully Customizable Invoice Design: Match the look of your invoice with the design of your brand.
- Zapier Integration Automation: Use the power of Zapier to integrate just about any app with your Invoice Ninja account.
- Attach Invoice & Quotations PDFs to Emails: Give your clients another easy way to share and file your invoice.
- Proposals Creation Tool: Easily create and send beautiful proposals to your customers.
- Bulk Emailing Invoices & Quotations: Save time by quickly selecting multiple invoices and emailing them out together.
- Setup Automatic Late Fees on Unpaid Invoices: Bill a client extra for unpaid invoices with automatic late payment fees.
- Customize Email Subjects & Body Text: Tailor your invoice email text for improved open rates and brand recognition.
- Attach Invoice & Quotations PDFs to Emails: Give your clients another easy way to share and file your invoice.
You can check out the feature comparison page for more details.
Install Invoice Ninja on CentOS 8
We will install Invoice Ninja on CentOS 8 Linux powered by LAMP ( CentOS Linux, Apache Web server, MariaDB and PHP) application stack. The minimum requirements at the hardware level is just 512mb of ram and 1 vcpu.
Login to your CentOS 8 Linux server as root or user that is able to run commands with sudo.
$ ssh [email protected]
Once you have the terminal access update the operating system.
sudo dnf -y update && sudo systemctl reboot
Step 1: Install PHP and Extensions required
Ensure PHP and extensions required are installed on your CentOS 8 Linux.
sudo dnf -y install @php
sudo dnf -y install php-{cli,fpm,gd,mbstring,curl,zip,xml,pdo,mysqlnd,pear,bcmath,json}
Check the version of PHP to confirm installation was successful.
$ php --version
PHP 7.2.24 (cli) (built: Oct 22 2019 08:28:36) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
Start and enable php-fpm service.
sudo systemctl enable --now php-fpm
Check status – It should be running.
$ systemctl status php-fpm
● php-fpm.service - The PHP FastCGI Process Manager
Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2020-07-13 22:39:31 CEST; 10s ago
Main PID: 2020 (php-fpm)
Status: "Processes active: 0, idle: 5, Requests: 0, slow: 0, Traffic: 0req/sec"
Tasks: 6 (limit: 12210)
Memory: 21.3M
CGroup: /system.slice/php-fpm.service
├─2020 php-fpm: master process (/etc/php-fpm.conf)
├─2021 php-fpm: pool www
├─2022 php-fpm: pool www
├─2023 php-fpm: pool www
├─2024 php-fpm: pool www
└─2025 php-fpm: pool www
Jul 13 22:39:31 centos-01.computingforgeeks.com systemd[1]: Starting The PHP FastCGI Process Manager...
Jul 13 22:39:31 centos-01.computingforgeeks.com systemd[1]: Started The PHP FastCGI Process Manager.
Step 2: Install and Configure MariaDB database
We’ll choose MariaDB database server for running Invoice Ninja application. Other database servers such as MySQL and PostgreSQL can also be used.
Run the following commands in your terminal to install MariaDB server on CentOS 8 Linux system.
sudo dnf -y install @mariadb
Start and set the database server to be started at system boot.
sudo systemctl enable --now mariadb
Secure the database server by setting root password and disable remote login for root user.
$ sudo mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
Create a database and user for Invoice Ninja running on CentOS 8.
$ mysql -u root -p
CREATE DATABASE invoice_ninja;
GRANT ALL ON invoice_ninja.* TO [email protected] IDENTIFIED BY "[email protected]";
FLUSH PRIVILEGES;
QUIT
Test database user connectivity.
$ mysql -u invoice_ninja -p'[email protected]' Welcome to the MariaDB monitor. Commands end with ; or g. Your MariaDB connection id is 17 Server version: 10.3.17-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. MariaDB [(none)]> SHOW DATABASES; -------------------- | Database | -------------------- | information_schema | | invoice_ninja | -------------------- 2 rows in set (0.003 sec) MariaDB [(none)]> QUIT Bye
Step 3: Install and Configure Apache httpd server
Next we install Apache httpd server.
sudo dnf -y install @httpd mod_ssl
Start and enable the service.
sudo systemctl enable --now httpd
Allow httpd and https service in the firewall.
sudo firewall-cmd --add-port={http,https} --permanent
sudo firewall-cmd --reload
Install wget and unzip.
sudo dnf -y install zip wget
Download Invoice Ninja Application.
wget https://download.invoiceninja.com/ -O invoice-ninja.zip
Confirm file is downloaded and saved locally to the server.
$ file invoice-ninja.zip
invoice-ninja.zip: Zip archive data, at least v1.0 to extract
Extract the file.
unzip invoice-ninja.zip
Move created directory to /var/www/html
sudo mv ninja /var/www/html/invoice-ninja
Set correct directory permissions.
sudo chown -R apache:apache /var/www/html/invoice-ninja
sudo chmod -R 755 /var/www/html/invoice-ninja/storage/
Create Apache configuration file.
sudo vi /etc/httpd/conf.d/invoice-ninja.conf
Add the following contents:
ServerName invoices.computingforgeeks.com
DocumentRoot /var/www/html/invoice-ninja/public
DirectoryIndex index.php
Options FollowSymLinks
AllowOverride All
Require all granted
CustomLog /var/log/httpd/invoice_ninja_access.log combined
ErrorLog /var/log/httpd/invoice_ninja_error.log
Confirm configuration file syntax:
$ sudo apachectl -t
Syntax OK
Step 4: Configure SSL for the Invoice Ninja Domain
For security we need to obtain a valid SSL certificate. You can use a self-signed certificate, free Let’s Encrypt SSL certificate or a certificate signed by an authorized CA.
I’ll use Let’s Encrypt SSL Certificate. We first need to stop the httpd web server.
sudo systemctl stop httpd
Download cerbot tool.
sudo wget https://dl.eff.org/certbot-auto -P /usr/local/bin
sudo chmod a x /usr/local/bin/certbot-auto
Request for the certificate.
export DOMAIN='invoices.computingforgeeks.com'
export EMAIL="[email protected]"
certbot-auto certonly --standalone -d $DOMAIN --preferred-challenges http --agree-tos -n -m $EMAIL --keep-until-expiring
Execution output:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator standalone, Installer None
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for invoices.computingforgeeks.com
Waiting for verification...
Cleaning up challenges
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/invoices.computingforgeeks.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/invoices.computingforgeeks.com/privkey.pem
Your cert will expire on 2020-10-11. To obtain a new or tweaked
version of this certificate in the future, simply run certbot-auto
again. To non-interactively renew *all* of your certificates, run
"certbot-auto renew"
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le
Reconfigure your Apache to include HTTPS sections.
ServerName invoices.computingforgeeks.com
DocumentRoot /var/www/html/invoice-ninja/public
RewriteEngine On
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/invoices.computingforgeeks.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/invoices.computingforgeeks.com/privkey.pem
ServerName invoices.computingforgeeks.com
DocumentRoot /var/www/html/invoice-ninja/public
DirectoryIndex index.php
Options FollowSymLinks
AllowOverride All
Require all granted
CustomLog /var/log/httpd/invoice_ninja_access.log combined
ErrorLog /var/log/httpd/invoice_ninja_error.log
Restart apache web server.
sudo systemctl restart httpd
Open your web browser and load the domain configured. It needs to be in your /etc/hosts or valid DNS.
Check SSL Certificate information.
Provide URL and database connection values.
Create first user who’ll be admin.
Once installation is complete login with the username and password set.
You should be taken to the Invoice Ninja dashboard which has the following look.
Visit Invoice Ninja documentation page for more learning on this great invoicing application.