This week end, Sean, a habitual reader, contacted me to ask some help on installing a particular invoice web based app on his server.
As you may have figured out, I love web based apps and I didn’t know any invoicing apps online before his mail. As I’m starting my own company/website soon (I’ll let you know when settle down), I thought it would be nice to give this software a shot.
InvoiceNinja is a great open source online invoicing service.
For $50 / year you can get their Ninja Pro version (A free one is available too) and they also let you install your own instance on your server. Their project is hosted on github and it doesn’t seems to be a less advanced version than the one they are selling.
InvoiceNinja allows you to easily create invoice and get paid online (30+ payment gateways). You can also create quotes that can be converted as invoice later on and even create recurring invocies.
Like it? Well, go for their Forever Free version / Paid version or install it on your own server:
To install Invoice Ninja on Ubuntu/Debian flavors, you will need a LAMP configuration (Apache, MySQL and PHP). If you don’t have that, simply follow this guide.
1) Clone their git repository into your /var/www
In root (Or with sudo), run:
cd /var/www git clone https://github.com/hillelcoren/invoice-ninja.git ninja
This might takes some time as you have to download around 90mb.
2) Install nodejs, npm and mcrypt on your system if not done already
– If you use Ubuntu, simple run (as root)
apt-get install nodejs npm php5-mcrypt
– For Debian users (Still on Wheezy?) like me, you can install nodejs from wheezy-backports. If you don’t have them in your source.list, you will need to add the line
deb http://http.debian.net/debian wheezy-backports main
to your /etc/apt/source.list file, then run
to update the packages list and then install nodejs with the following command:
apt-get install nodejs nodejs-legacy curl php5-mcrypt
and for npm, you can use the installer (still in root)
curl https://www.npmjs.com/install.sh | sh
3) Install composer to manage PHP dependencies
Still in root, run:
curl -s http://getcomposer.org/installer | php mv composer.phar /usr/bin/composer
4) Install the required dependencies with composer
You will need to install Laravel packages using Composer.
Still in root, run:
cd ninja composer install
If composer fail with timeout issue, it might be due to poor connection/bandwidth (From your side or git side). To solve this issue, just run it as follow:
COMPOSER_PROCESS_TIMEOUT=2000 composer install
Also, since you will download a lot of dependencies from github, you will need to register and enter your username/password to go over the API limit. At certain point of time, you will need to enter those credentials.
5) Create a dedicated database
Using phpmyadmin or similar, create a dedicated database.
In my case, I created a database called ninja with a dedicated user called ninja
6) Change the owner of your /var/www/ninja folder
To avoid permissions issues, the easiest is to change the owner of your /var/www/ninja, from root to your web server user (www-data).
Still in root, run:
chown -R www-data:www-data /var/www/ninja
7) Create a dedicated virtualhost
I suggest you to have a dedicated virtualhost to access to your Ninja instance through sub.domain.tld for example and even to force HTTPS. Make sure to link it to ninja/public folder.
To do so, you will need:
1) Create a A redirection in your DNS server/registrar with something like inv.domain.tld to your IP
2) Have SSL certificate ready. If not you can read this tutorial. (Optional)
3) Create your virtualhost as following:
In /etc/apache2/sites-enabled/, create a file called ninja (or reuse one of yours), In root:
and paste the following content:
<VirtualHost *:80> ServerAdmin email@example.com ServerName inv.domain.tld Redirect / https://inv.domain.tld </VirtualHost> <IfModule mod_ssl.c> <VirtualHost *:443> SSLEngine on SSLCertificateFile /etc/ssl/certs/myblog.pem SSLCertificateKeyFile /etc/ssl/private/myblog.key ServerAdmin firstname.lastname@example.org ServerName inv.domain.tld DocumentRoot /var/www/ninja/public <Directory /var/www/ninja/public> AllowOverride All </Directory> </VirtualHost> </IfModule>
Adapt the content (Servername, webmaster email, SSL certificate, directory,…). If you don’t want to use SSL, you will need to tweak a bit this virtualhost.
When done, save the file (CTRL+X then Yes) and reload apache: (In root)
8) Run the web installer
Simply go to inv.domain.tld and you will be able to finalize the installation online.
You will need to enter the credentials of your MySQL database previously created and could also add your email server details to send the invoice to your customers.
And you should be good to go!
You know any others similar service, drop a comment!