Installing Invoice Ninja on CentOS 7 w/ NGINX & MariaDB – Part One

Invoice Ninja Logo


Invoice Ninja is a free and open source invoicing system. The site also provides invoicing through Software as a Service (SaaS). But, of course, it’s possible to install and configure the software on a private server, which is a better option for companies that find themselves juggling a large number of payments.

Invoice ninja boasts many great features, depending on the plan that you chooce: Free, Pro, or Enterprise. With the free option, the following features are included:

  • create and email invoices with one click;
  • create recurring invoicing;
  • 45+ payment gateways supported;
  • accept deposits and partial payments;
  • auto-reminder emails for invoice payments;
  • shows payments in PDF files;

and more!

In this two-parts tutorial we will look at the process of installing and configuring Invoice Ninja on a server with CentOS 7 and NGINX.
In Part One, we’ll configure the system with required dependencies, and in the next we’ll work through the detailed installation of Invoice Ninja.

Install and configure NGINX

If not present, install the EPEL repository:

# yum install epel-release

Next, install NGINX:

# yum install nginx

Start and enable it to run at boot time:

# systemctl start nginx
# systemctl enable nginx

Check that NGINX is listening on port 80:

# netstat -plntu | grep 80

The output should be the following one:

tcp        0      0    *               LISTEN      3035/nginx: master  
tcp6       0      0 :::80                   :::*                    LISTEN      3035/nginx: master


Install MariaDB

Install MariaDB Server with yum:

# yum install mariadb-server

Then, run it:

# systemctl start mariadb
# systemctl enable mariadb

Set up its root account:

# mysql_secure_installation
Set root password? [Y/n] 
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!

Remove anonymous users? [Y/n] 
 ... Success!

Disallow root login remotely? [Y/n] 
 ... Success!

Remove test database and access to it? [Y/n] 
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reload privilege tables now? [Y/n] 
 ... 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!

After that, start the MariaDB shell:

# mysql -u root -p

Create new database (ininjadb) and user (ininjausr):

MariaDB [(none)]> CREATE DATABASE ininjadb;
Query OK, 1 row affected (0.01 sec)

MariaDB [(none)]> CREATE USER [email protected] IDENTIFIED BY 'usr_strong_password';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON ininjadb.* TO [email protected] IDENTIFIED BY 'usr_strong_password';
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> EXIT;

MariaDB is now correctly configured.

Install PHP-FPM

Invoice Ninja requires PHP 5.9+, so let’s install PHP7-FPM. This is not available in the CentOS repositories, so add an external one:

# rpm -Uvh

Next, install PHP:

# yum install php70w-fpm php70w-cli php70w-pear php70w-gd php70w-xml php70w-mysql php70w-zip php70w-mbstring php70w-mcrypt php70w-curl php70w-gmp php70w-pdo

At the end, edit the PHP configuration file:

# $EDITOR /etc/php.ini

There, uncomment the cgi.fix_pathinfo line, and change its value:


Save, exit, and edit the PHP-FPM configuration file:

# $EDITOR /etc/php-fpm.d/www.conf

Change user and group, as follows:

; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
; RPM: apache Choosed to be able to access some dir as httpd
user = nginx
; RPM: Keep a group allowed to write in log dir.
group = nginx

Change “listen” line for using a socket:

listen = /var/run/php/php-fpm

Next, uncomment and edit as follow the lines:

listen.owner = nginx = nginx
listen.mode = 0660

Uncomment environment lines, starting at line 366:

; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
; the current environment.
; Default Value: clean env
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp

Save, exit and create a new PHP session directory:

# mkdir -p /var/lib/php/session

Change its owner to nginx user:

# chown -R nginx:nginx /var/lib/php/session

Create a new directory for the socket file, named as configured previously on www.conf:

# mkdir -p /var/run/php
# chown -R nginx:nginx /var/run/php

Start and enable PHP:

# systemctl start php-fpm
# systemctl enable php-fpm

Check with netstat that everything went well and is running smoothly:

# netstat -pxl | grep php
unix  2      [ ACC ]     STREAM     LISTENING     81417    5190/php-fpm: maste  /var/run/php/php-fpm


In this first part, we’ve looked at the process of configuring CentOS 7 and installing the dependencies required by Invoice Ninja. In the next tutorial, we’ll see how to complete the process of installing Invoice Ninja!

  • @Oliver T. Kidd If you are curious and excited about taking home $100 every single day… view this info>>

  • Thanks, I still do not understand why there are no GUIs for this kind of things, to make it even easier than copy paste some command lines.

  • I started doing freelancing over net, through some necessary assignments which simply desired a laptop or computer as well as access to internet and therefore I am satisfied than ever before… a few months have passed by since i started this and therefore i had income total of $36k… Normally I earn eighty bucks every single hour and work for three to 4 hours many of the days.And great thing about this is exactly that one could organize time when you work and so for how long as you like but you still gain a take-home pay each week. —->>>LEARN MORE Regarding It here-> V15.UK/mfSiq


  • I got started freelancing over world wide web, by doing some rudimentary projects which basically required a desktop and consequently having access to internet and additionally Now I am more delighted than before… half a year get surpassed ever since i started this and also i had money total of $36,000… Usually I make 80 dollars every single hr and work for three to 4 hrs nearly all the days.And fantastic thing about this is that you could organize valuable time whenever you work and so for how long as you like and you achieve a take-home pay a week. —->>>LEARN Way more ABOUT IT here-> RU.VU/qw98K


  • I got started freelancing over world wide web, through some necessary projects which mainly demanded a laptop or computer together with having access to net and additionally I am more happy than before… six months time have passed when i started out this and additionally i received profit total of $36,000… Normally I earn 80 usd each one hr and also work for three to four hrs nearly all the times.And attractiveness of this is exactly that one could manage precious time whenever you work and also for how long as you like but you still gain a take-home pay a week. —->>>LEARN A lot more About That here-> GOCHIURL.COM/15d91