How to install invoice ninja on CentOS 8

You can download this article in PDF format to support us through the following link.

Download the guide in PDF format

turn off


Invoice Ninja is a free open source application for generating invoices, managing payments, tracking expenses, time and task tracking, and more. The application is written in PHP and requires a web server (such as Nginx or Apache httpd) to provide its web content. Using this tool, you can create an invoice and send the invoice to the client within a few seconds after installation. Its design is highly customizable, which means it can be easily integrated with your consulting business, service website or e-commerce platform.

In this article, I will guide you through the process of installing Invoice Ninja on a CentOS 8 Linux server. Some cool features of Invoice Ninja are:

  • Create recurring invoices and automatically settle customers
  • Alert when customers view and pay invoices
  • Email invoices and accept payments online
  • Accept deposits and partial payments
  • Password protect client portal
  • Attach invoice.PDF to email
  • Customize invoices with company logo
  • Create project tasks and track time online
  • Create quotations and proforma invoices
  • Automatic reminder email for invoice payment
  • Tax setting for each item or invoice total
  • Professional invoice template design
  • Convert quotes to payment invoices
  • and many more

Some features are only available as commercial products. These include:

  • Fully customizable invoice design: Match the appearance of the invoice with the brand design.
  • Zapier integrated automation: Use Zapier’s features to integrate almost all applications with your Invoice Ninja account.
  • Attach invoice and quotation PDF to email: Provide your customers with another easy way to share and archive your invoices.
  • Proposal creation tool: Easily create beautiful proposals and send them to your customers.
  • Bulk emailed invoices and quotations: Quickly select multiple invoices and email them together to save time.
  • Set up automatic late fees for unpaid invoices: Extra charges for unpaid invoices are charged to customers, and late fees are automatically charged.
  • Custom email subject and body: Customize the invoice email text to improve the opening rate and brand awareness.
  • Attach PDF of invoice and quotation to email: Provide your customers with another easy way to share and file invoices.

You can view Feature comparison page more details.

Install invoice ninja on CentOS 8

We will install Invoice Ninja on the CentOS 8 Linux (CentOS Linux, Apache Web server, MariaDB and PHP) application stack powered by LAMP. The minimum requirements at the hardware level are only 512 megabytes Ram and 1 vcpu.

Log in to the CentOS 8 Linux server as a super user or a user who can use sudo to run commands.

$ ssh [email protected]

After you have access to the terminal, update the operating system.

sudo dnf -y update && sudo systemctl reboot

Step 1: Install required PHP and extensions

Make sure that the required PHP and extensions are installed on 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 PHP version to confirm successful installation.

$ 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 the 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 systemd[1]: Starting The PHP FastCGI Process Manager...
Jul 13 22:39:31 systemd[1]: Started The PHP FastCGI Process Manager.

Step 2: Install and configure MariaDB database

We will choose the MariaDB database server to run the Invoice Ninja application. You can also use other database servers, such as MySQL and PostgreSQL.

Run the following command in the terminal to install MariaDB server on CentOS 8 Linux system.

sudo dnf -y install @mariadb

Start and set up the database server to be started when the system boots.

sudo systemctl enable --now mariadb

Protect the security of the database server by setting the root password, and disable remote login for the root user.

$ sudo mysql_secure_installation


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]";

Test the database user connection.

$ 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

Step 3: Install and configure Apache httpd server

Next, we install the Apache httpd server.

sudo dnf -y install @httpd mod_ssl

Start and enable the service.

sudo systemctl enable --now httpd

Allow httpd and https services 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 the invoice ninja app.

wget -O

Confirm that the file has been downloaded and saved locally to the server.

$ file Zip archive data, at least v1.0 to extract

Unzip the file.


Move the created directory to /var/www/html

sudo mv ninja /var/www/html/invoice-ninja

Set the correct directory permissions.

sudo chown -R apache:apache /var/www/html/invoice-ninja
sudo chmod -R 755 /var/www/html/invoice-ninja/storage/

Create an Apache configuration file.

sudo vi /etc/httpd/conf.d/invoice-ninja.conf

Add the following:

    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 the configuration file syntax:

$ sudo apachectl -t
Syntax OK

Step 4: Configure SSL for the invoice ninja domain

For security reasons, we need to obtain a valid SSL certificate. You can use a self-signed certificate, a free Let’s Encrypt SSL certificate or a certificate signed by an authorized CA.

I will use “encrypted SSL certificate”. We first need to stop the httpd web server.

sudo systemctl stop httpd

Download the cerbot tool.

sudo wget -P /usr/local/bin
sudo chmod a+x /usr/local/bin/certbot-auto

Certificate required.

export DOMAIN=''
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
Waiting for verification...
Cleaning up challenges

 - Congratulations! Your certificate and chain have been saved at:
   Your key file has been saved at:
   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:
   Donating to EFF:          

Reconfigure your Apache to include the HTTPS part.

    DocumentRoot /var/www/html/invoice-ninja/public
    RewriteEngine On
    RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]

    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/
    SSLCertificateKeyFile /etc/letsencrypt/live/

    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 the apache web server.

sudo systemctl restart httpd

Open your web browser and load the configured domain. It must be in your /etc/hosts or a valid DNS.

Check the SSL certificate information.

Provide the URL and database connection value.

How to install invoice ninja on CentOS 8

Create the first user who will become an administrator.

How to install invoice ninja on CentOS 8

After the installation is complete, use the user name and password to set up login.

How to install invoice ninja on CentOS 8

You will be taken to the Invoice Ninja dashboard with the following appearance.

How to install invoice ninja on CentOS 8

Visit the “Ninja Invoices” document page to get more information about this excellent invoice application.

You can download this article in PDF format to support us through the following link.

Download the guide in PDF format

turn off