Installing and Configuring Invoice Ninja on CentOS 7 w/ NGINX & MariaDB

存储架构 2017-04-25

Introduction

Invoice Ninjais a free and open source invoicing system. The site also provides invoicing through Software as a Service (SaaS). But, of course, it’s possible to install and configure the software on a private server, which is a better option for companies that find themselves juggling a large number of payments.

Invoice ninjaboasts many great features, depending on the plan that you chooce: Free , Pro , or Enterprise . With the free option, the following features are included:

  • create and email invoices with one click;
  • create recurring invoicing;
  • 45+ payment gateways supported;
  • accept deposits and partial payments;
  • auto-reminder emails for invoice payments;
  • shows payments in PDF files;

and more!

In this two-parts tutorial we will look at the process of installing and configuring Invoice Ninja on a server with CentOS 7 and NGINX.

In Part One, we’ll configure the system with required dependencies, and in the next we’ll work through the detailed installation of Invoice Ninja.

Install and configure NGINX

If not present, install the EPEL repository:

# yum install epel-release

Next, install NGINX:

# yum install nginx

Start and enable it to run at boot time:

# systemctl start nginx
# systemctl enable nginx

Check that NGINX is listening on port 80:

# netstat -plntu | grep 80

The output should be the following one:

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      3035/nginx: master  
tcp6       0      0 :::80                   :::*                    LISTEN      3035/nginx: master

Install MariaDB

Install MariaDB Server with yum :

# yum install mariadb-server

Then, run it:

# systemctl start mariadb
# systemctl enable mariadb

Set up its root account:

# mysql_secure_installation
Set root password? [Y/n] 
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!

Remove anonymous users? [Y/n] 
 ... Success!

Disallow root login remotely? [Y/n] 
 ... Success!

Remove test database and access to it? [Y/n] 
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reload privilege tables now? [Y/n] 
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

After that, start the MariaDB shell:

# mysql -u root -p

Create new database ( ininjadb ) and user ( ininjausr ):

MariaDB [(none)]> CREATE DATABASE ininjadb;
Query OK, 1 row affected (0.01 sec)

MariaDB [(none)]> CREATE USER [email protected]

IDENTIFIED BY 'usr_strong_password';Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]>
GRANT ALL PRIVILEGES ON ininjadb.* TO[email protected] IDENTIFIED BY 'usr_strong_password';Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]>
FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]>
EXIT;

Bye

MariaDB is now correctly configured.

Install PHP-FPM

Invoice Ninja requires PHP 5.9+, so let’s install PHP7-FPM. This is not available in the CentOS repositories, so add an external one:

# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

Next, install PHP:

# yum install php70w-fpm php70w-cli php70w-pear php70w-gd php70w-xml php70w-mysql php70w-zip php70w-mbstring php70w-mcrypt php70w-curl php70w-gmp php70w-pdo

At the end, edit the PHP configuration file:

# $EDITOR /etc/php.ini

There, uncomment the cgi.fix_pathinfo line, and change its value:

cgi.fix_pathinfo=0

Save, exit, and edit the PHP-FPM configuration file:

# $EDITOR /etc/php-fpm.d/www.conf

Change user and group, as follows:

; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
; RPM: apache Choosed to be able to access some dir as httpd
user = nginx
; RPM: Keep a group allowed to write in log dir.
group = nginx

Change “listen” line for using a socket:

listen = /var/run/php/php-fpm

Next, uncomment and edit as follow the lines:

listen.owner = nginx
listen.group = nginx
listen.mode = 0660

Uncomment environment lines, starting at line 366:

; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
; the current environment.
; Default Value: clean env
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp

Save, exit and create a new PHP session directory:

# mkdir -p /var/lib/php/session

Change its owner to nginx user:

# chown -R nginx:nginx /var/lib/php/session

Create a new directory for the socket file, named as configured previously on www.conf :

# mkdir -p /var/run/php
# chown -R nginx:nginx /var/run/php

Start and enable PHP:

# systemctl start php-fpm
# systemctl enable php-fpm

Check with netstat that everything went well and is running smoothly:

# netstat -pxl | grep php
unix  2      [ ACC ]     STREAM     LISTENING     81417    5190/php-fpm: maste  /var/run/php/php-fpm

Conclusions

In this first part, we’ve looked at the process of configuring CentOS 7 and installing the dependencies required by Invoice Ninja. In the next tutorial, we’ll see how to complete the process of installing Invoice Ninja!

Unixmen Home

责编内容by:Unixmen Home (源链)。感谢您的支持!

您可能感兴趣的

CentOS7安装supervisor supervisord 是Linux/Unix系统下的一个进程管理工具 一、安装 sudo yum install supervisor 二、设置...
Subquery Optimizations Map 以下是显示SQL语言中允许的所有类型的子查询的映射,以及可用于处理它们的优化程序策略。 无色区域表示不同种类的子查询,例如: ...
诡异的 Mac + PHP + Nginx 问题 问题描述 这次是微信公众号开发,本身就有很多问题,也严重加剧了我调试的难度。正在做一个 WordPress 插件,功能是将公众号文章和 WordPress ...
在Centos7上源码编译httpd 在Centos7上源码编译httpd 安装源码包 首先在http://httpd.apache.org下载所需要的安装包 小编在这里下载的是http...
从JavaWeb的角度认识Nginx 作为一名JavaWeb方向程序员,更多的是写服务器后台代码,但是俗话说,不想当架构师的程序员不是好程序员,我们要对并发、负载等词汇进行深入探索。 一、重新认...