This tutorial covers the installation of Invoice Ninja onto Centos 7 VPS with Apache, PHP, and MariaDB. Invoice Ninja is a free and self-hosted platform for invoicing, billing, and payment management based on Laravel. It is very easy to use and it can be integrated with most of the popular payment gateways, including PayPal, 2CheckOut, Stripe, WePay, and many more… which makes it a perfect solution for freelancers and small or medium-sized businesses. Looking to get some fully managed hosting for your InvoiceNinja account? We offer complete migration, installation, optimization, and customization – 100% free of charge! Check out our premium affordable VPS hosting packages and switch to a more secure, more efficient server with 24/7/265 amazing customer support today.
– Create invoices and quotations in no time
– Easy time tracking & task creation.
– Send invoices and accept online payments
– Integrate with 30+ gateways including Stripe, PayPal, Authorize and Dwolla
– Easily create quotes and invoices online
– Custom invoice URL’s Company.InvoiceNinja.com
– iOS and Android apps
Prerequisites
– CentOS 7 VPS with 2GB of RAM
– SSH access with root privileges
– PHP version 5.5.9 or newer
– MySQL/MariaDB database server
– Apache/Nginx web server
Login via SSH and update the server
We will install Invoice Ninja through the command line interface, so first, we need to login to the CentOS 7 VPS via SSH as user root
ssh root@IP_Address -p Port_Number
Once you are logged in, don’t forget to update all packages installed on the server
yum -y update
Install Apache web server
Apache can be easily installed from the official CentoOS 7 repositories using the following command
yum -y install httpd
After the installation manager complete the installation, start the web server and enable it to start automatically after a restart
systemctl start httpd systemctl enable httpd
Install PHP 7
CentOS 7 by default comes with PHP 5.4 which has reached the end of life and it is no longer supported. So, in this tutorial we will install PHP 7 instead. For this purpose we have to add the Webtatic EL yum repository.
yum -y install epel-release rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
Once the repository is added, we can proceed to install PHP and several PHP modules
yum install php70w php70w-common php70w-curl php70w-mysql php70w-mbstring php70w-mcrypt php70w-xml php70w-cli php70w
verify that PHP 7 is installed
php -v PHP 7.0.31 (cli) (built: Jul 20 2018 08:55:22) ( NTS ) Copyright (c) 1997-2017 The PHP Group
Install MariaDB database server
Invoice Ninja stores its information in a database. So, we will install MariaDB database server and create a new database along with a user able to access it. Run the following command to install MariaDB server
yum -y install mariadb
Start the server and enable it to start upon reboot
systemctl start mariadb systemctl enable mariadb
Run the ‘mysql_secure_installation’ post installation script to secure your MariaDB server and set a password for the MySQL ‘root’ user.
Next, login to the database server as user root,
mysql -u root -p MariaDB [(none)]> CREATE DATABASE ninja; MariaDB [(none)]> CREATE USER 'user'@'localhost' IDENTIFIED BY 'PASSWORD'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON ninja.* TO 'user'@'localhost'; MariaDB [(none)]> FLUSH PRIVILEGES MariaDB [(none)]> exit
Replace ‘PASSWORD’ with an actual strong password.
Install and Configure Invoice Ninja
Download the latest stable of Invoice Ninja to your server. At the moment of writing this article it is version 4.5.3
curl -L https://download.invoiceninja.com/ -o invoiceninja.zip
unpack the downloaded ZIP file to the document root the directory of your server. The ZIP file includes all necessary third party libraries.
unzip invoiceninja.zip -d /var/www/html
The content of Invoice Ninja will be stored in a new ‘ninja’ directory.
Configure Invoice Ninja to use the newly created MariaDB database
cd /var/www/html/ninja/ cp -v .env.example .env
Open the .env file and find and modify the following lines
DB_DATABASE=ninja DB_USERNAME=user DB_PASSWORD=PASSWORD
Save the changes and run the following commands necessary to prepare the MariaDB database
php artisan migrate php artisan db:seed
Set the correct ownership to the Invoice Ninja directory
chown -R apache:apache /var/www/html/ninja
Create Apache virtual host
In order to be able to access Invoice Ninja with your domain name, we will create Apache virtual host for the domain.
Create a new virtual host directive with the following content
vi /etc/httpd/conf.d/invoiceninja.conf ServerAdmin admin@your-domain.com DocumentRoot /var/www/html/ninja/public ServerName your-domain.com ServerAlias www.your-domain.com Options +FollowSymlinks AllowOverride All ErrorLog /var/log/httpd/invoiceninja-error_log CustomLog /var/log/httpd/invoiceninja-access_log common
Save the file and restart the web server for the changes to take effect
systemctl restart httpd
If you closely followed the tutorial, with this step the installation of Invoice Ninja is completed and you can start using it. Open your web browser and navigate it to http://your-domain.com and follow the web-based installation wizard to finalize the installation.
Of course, you don’t have to install Invoice Ninja on CentOS 7 if you use one of our Managed CentOS Hosting or Linux VPS hosting plans, in which case you can simply ask our expert Linux admins to install Invoice Ninja on CentOS 7 for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post on how to install Invoice Ninja on CentOS 7, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks
Thank you, you have a typo in vhost conf file: invoiceninja.conf
AllowOverride All instead of AllowOverride Al (notice the missed ‘l’)
Thanks, the tutorial has been updated.