How to Install InvoiceNinja on Ubuntu 18.04 Bionic Beaver

Install InvoiceNinja on Ubuntu 18.04

In this article, we will have explained the necessary steps to install and configure InvoiceNinja on Ubuntu 18.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

InvoiceNinja is an open-source software application for invoicing and billing customers. It is built using PHP and JavaScript, on top of the Laravel framework. Some of the features include recurring invoices, creating tasks, proposals and projects, invoice designs, more than 40 payment options, and partial payments. This free open source platform is built on the LAMP or LEMP stack and can a great alternative to your current implementation.

Install InvoiceNinja on Ubuntu

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

sudo apt update
sudo apt upgrade

Step 2. Install LAMP Stack.

InvoiceNinja is build with PHP. You can host it like you would any other web app written in PHP. So, you’re going to need to set Ubuntu up as either a LAMP server. If you haven’t done so already, use our traditional LAMP guide to set up Ubuntu to serve PHP before you continue.

Step 3. Install Composer.

Now that we have php cli installed on our machine, we can download the composer installer with:

php -r "copy('', 'composer-setup.php');"

File composer-setup.php will be downloaded to current working directory. After that, check the data integrity of the script by comparing the script SHA-384 hash on the Composer Signatures page.

HASH="$(wget -q -O -"

Now run the following command to verify that the installation script is not corrupted:

php -r "if (hash_file('SHA384', 'composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

You will get following output if the hashes match:

Installer verified

Next, the following command will install Composer in the /usr/local/bin directory:

sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer

Step 4. Install Invoice Ninja.

Run the following command to download the latest version of InvoiceNinja zip file onto your server:

cd /var/www/html
sudo git clone
cd /var/www/html/invoiceninja
sudo composer install

Set the directory permissions accordingly:

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

Step 4. Creating MariaDB database for InvoiceNinja.

PrestaShop uses MariaDB database to store all its data like posts, pages, users, plugins and themes settings. Log in to your MariaDB server with the following command and enter your MariaDB root password:

mysql -u root -p

Once you’re in the MariaDB console, create a new database:

MariaDB > CREATE DATABASE invoiceninja;
MariaDB > CREATE USER 'invoiceninjauser'@'localhost' IDENTIFIED BY 'new_strong_password_here';
MariaDB > GRANT ALL ON invoiceninja.* TO 'invoiceninjauser'@'localhost' IDENTIFIED BY 'user_password_here' WITH GRANT OPTION;
MariaDB > flush privileges;
MariaDB > exit;

Step 6. Configure Apache for InvoiceNinja.

Run the commands below to create a new configuration file called invoiceninja.conf:

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

And add the following content to the file:

<VirtualHost *:80>
     ServerAdmin [email protected]
     DocumentRoot /var/www/html/invoiceninja/public

     <Directory /var/www/html/invoiceninja/public>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted

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


For the new configuration to take effect, restart the Apache service by typing:

sudo a2ensite invoiceninja.conf 
sudo a2enmod rewrite
sudo systemctl restart apache2

Step 7. Completing the InvoiceNinja Installation.

You can now finalize your InvoiceNinja website installation by typing the public IP address associated with your Ubuntu 18.04 server on a browser. You will get a screen similar to the one below:

Then follow the on-screen instructions, you will be asked to input your database configuration, administrative details and other configuration settings. When complete you may sign-in and start using InvoiceNinja. Return to anytime thereafter to sign-in.

That’s all you need to do to install InvoiceNinja on Ubuntu 18.04. I hope you find this quick tip helpful. If you have questions or suggestions, feel free to leave a comment below.