TechPop: How to Install Invoice Ninja on Ubuntu 14.04

Invoice Ninja is a free and open source invoicing software. Their site provides Invoice Ninja as SaaS  (Software as a Service), but if you or your company is more security and privacy minded, it can be hosted on a private server. One major benefit of Invoice Ninja is it’s compatibility with over thirty payment gateways. Automation processes such as recurring invoices are also found within Invoice Ninja. Find out how to install Invoice Ninja on Ubuntu 14.04

Acknowledgements

Instructions and support for properly installing Invoice Ninja were not only provided by Invoice Ninja’s support team, other sites gave important lines of code in order to get Invoice Ninja running. Credits go towards Rosehosting’s Debian Install tutorial and Freedif’s Install tutorial. This tutorial consolidates some of their code as well as includes the video tutorial.

Prerequisites

This tutorial assumes an Ubuntu 14.04 Desktop edition server is setup. (Instructions will work with Ubuntu 14.04 Server). In addition, if Invoice Ninja will be accessible to an external network, a Web address is needed. If either of these are not setup, click on the necessary tutorials below and then return to this tutorial.

Video Tutorial

Install Dependencies

We need to install additional php5 dependencies and the git and curl dependencies to retrieve needed files.

sudo apt-get install php5-gd php5-curl php5-mcrypt git curl
sudo php5enmod mcrypt

Install Composer

Composer will pull multiple dependencies from their respective repositories to build the Laravel framework that Invoice Ninja is built from.

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

Install Invoice Ninja

  1. Pull needed files from Github into the folder ‘ninja’
    git clone https://github.com/hillelcoren/invoice-ninja.git ninja

    02-gitclone

  2. Move the ninja folder to the web server directory. Then change directory to the ninja folder.
    sudo mv ninja /var/www/
    cd /var/www/ninja
  3. Use composer to install framework
    sudo composer install

    NOTE: During the composer install, the screen will look like the following:
    05-composerinstallNOTE: Part way through the composer install, the public download limit of Github will be reached. Composer will as for login credentials to continue. Simply create an account at Github to continue.
    06-githubpassword

  4. Update Composer and re-install packages
    sudo composer update
    sudo composer install

     

Create MySQL Database

  1. Log into MySQL as root
    mysql -u root -p
  2. Create the database
    CREATE SCHEMA `ninja` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

    NOTE: To increase security, change the database name from the default ‘ninja.’

  3. Create the MySQL user and password
    CREATE USER 'ninja'@'localhost' IDENTIFIED BY 'ninja';

    NOTE: To increase security of your Invoice Ninja app, change the user and password above. (The user is the first ‘ninja’ and the password is the second ‘ninja’).

  4. Grant privileges of the new database to the new user
    GRANT ALL PRIVILEGES ON `ninja`.* TO 'ninja'@'localhost';

    NOTE: If you made any changes to the username or database name above, make those changes to this command. (The first ‘ninja’ is the database and the second ‘ninja’ is the username).

  5. Flush the database privileges
    FLUSH PRIVILEGES;
  6. Exit MySQL
    exit

07-mysql

Configure Apache Web Server

  1. Open the default sites configuration file
    sudo nano /etc/apache2/sites-available/000-default.conf
  2. Change the DocumentRoot line to the ‘public’ sub-folder of the ninja folder. Then add a directory rewrite for the folder
    DocumentRoot /var/www/ninja/public
    
    <Directory /var/www/ninja/public>
    AllowOverride All
    </Directory>

    08-apacheconf

  3. Enable the rewrite apache mod
    sudo a2enmod rewrite
    sudo service apache2 restart

Invoice Ninja Web Setup

  1. Enable the production environment for Invoice Ninja
    sudo cp bootstrap/environment.default.php bootstrap/environment.php
  2. Change ownership of the ninja folder to the web server.
    sudo chown www-data:www-data -R /var/www/ninja
  3. Open a web browser and navigate to the web server
    09-webinstall
  4. Update database information if necessary. Test the connection to ensure correct information
    10-confirmdatabase
  5. Input SMTP email server information. Send a test email.
    11-emailsettings
  6. Create the administrative user information (A). Accept the Terms of Services (B) and click the Submit button (C).
    12-login

Congratulations! Invoice Ninja is installed on operational!
13-finlogin


Support Us!

Thank you for reading this article. If you found it useful, please consider buying us a coffee, subscribing to the YouTube Channel, and/or changing your Amazon bookmark to our affiliate link (CAN, USA, UK). We do this out of general interests and to help others. Thanks!




Leave a Reply

Your email address will not be published.