How to Install Invoice Ninja on Ubuntu 18.04

Install Invoice Ninja on Ubuntu 18.04

In this tutorial we are going to learn how to install Invoice Ninja on Ubuntu 18.04. We will also install and configure its prerequisites. Invoice Ninja is a free and open source web-based application that can be used for invoicing, payments, time tracking and much more. It is the best solution for invoicing and billing customers. You can easily create and send invoices online in seconds. Invoice Ninja allows you to create custom invoices and show live invoices as a PDF file.

I recommend to use a minimal Ubuntu server setup as a basis for the tutorial, that can be a virtual or a root server image with an Ubuntu 18.04 Bionic Beaver minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.

Install Invoice Ninja on Ubuntu 18.04

Step 1. First, ensure your system and apt package lists are fully up-to-date by running the following:

apt-get update -y
apt-get upgrade -y

Step 2. Installing LAMP on Ubuntu 18.04 LTS.

You should check out this LAMP stack install tutorial for Ubuntu 18.04, if you haven’t installed LAMP yet. Once it’s installed, come back here and read on. We also will install the required packages for LAMP stack and the important PHP extension that Invoice Ninja relies on:

apt-get install php7.2 libapache2-mod-php7.2 php7.2-common php7.2-mbstring php7.2-xmlrpc php7.2-soap php7.2-mysql php7.2-gd php7.2-xml php7.2-cli php7.2-zip

Step 3. Download and Install Invoice Ninja on Ubuntu 18.04.

First, Download Invoice Ninja from the official web site. The latest stable release is 4.4.4 so you can download it with the following command:

sudo mv ninja /var/www/html/invoiceninja

Now just set the right permissions for the folders:

sudo chown -R www-data:www-data /var/www/html/invoiceninja/
sudo chmod -R 755 /var/www/html/invoiceninja/

Step 4. Create a database for Invoice Ninja.

Next, we need to create a database for the Invoice Ninja installation:

mysql -uroot -p

Run the following command to create a database for Invoice Ninja:

MariaDB [(none)]> CREATE DATABASE ninja_db;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON ninja_db.* TO 'ninja'@'localhost' IDENTIFIED BY 'password';
MariaDB [(none)]> \q

Step 5. Configure Apache web server for osTicket.

For this you can take the default config as a template:

cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/invoiceninja.conf

Now edit the currently created Config as follows:

nano /etc/apache2/sites-available/invoiceninja.conf

Modify the virtual host file for your osTicket site to resemble the example below:

<VirtualHost my-domain.tld:80>

ServerName my-domain.tld
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/invoiceninja/public

<Directory /var/www/html/invoiceninja/public/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All

ErrorLog ${APACHE_LOG_DIR}/error-invoiceninja.log
CustomLog ${APACHE_LOG_DIR}/access-invoiceninja.log combined

Finally, reload the web server as suggested, for the changes to take effect:

sudo a2ensite invoiceninja.conf
sudo a2enmod rewrite
systemctl restart apache2

Step 6. Accessing osTicket.

You can now complete the installation with the Invoice Ninja web interface. Open your web browser and navigate to or http://{your-server-ip} to launch the installer.

Congratulation’s! You have successfully install and configured Invoice Ninja on your Ubuntu 18.04 LTS server. Thanks for using this tutorial for installing Invoice Ninja on Ubuntu 18.04 LTS (Bionic Beaver) system.