Cara Install InvoicePlane dengan Nginx di CentOS 7
InvoicePlane adalah aplikasi faktur sumber terbuka dan gratis. Kode sumbernya dapat ditemukan di Github. Tutorial kali ini akan menunjukkan cara menginstal InvoicePlane pada sistem CentOS 7 yang baru.
Daftar Isi
Requirements
- WebServer (Apache, NGINX). This tutorial will use Nginx.
- MySQL version 5.5 or greater or the equivalent version of MariaDB.
- PHP version 7.0 or greater with the following PHP extensions installed and activated:
php-gd
php-hash
php-json
php-mbstring
php-mcrypt
php-mysqli
php-openssl
php-recode
php-xmlrpc
php-zlib
Prerequisites
- A server running CentOS 7.
- A non-root user with sudo privileges.
Step Initial
Cek Versi CentOS system:
cat /etc/centos-release # CentOS Linux release 7.6.1810 (Core)
Set up timezone:
timedatectl list-timezones sudo timedatectl set-timezone 'Region/City'
Update operating system packages:
sudo yum update -y
Install required packages:
sudo yum install -y vim wget curl git bash-completion unzip
Step 1 – Install PHP and required PHP extensions
Aplikasi web InovicePlane membutuhkan PHP versi 7.0.0 atau lebih tinggi. Repositori CentOS standar berisi versi PHP yang lebih lama, dan dengan demikian kita perlu menyiapkan repositori pihak ketiga untuk menginstal versi PHP yang lebih baru. Kami akan menggunakan repositori Webtatic.
Setup the Webtatic YUM repo:
sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
Install PHP, as well as the necessary PHP extensions:
sudo yum install -y php72w php72w-cli php72w-fpm php72w-common php72w-gd php72w-json php72w-mbstring php72w-mcrypt php72w-mysql php72w-xmlrpc php72w-recode
Check the PHP version:
php --version # PHP 7.2.12 (cli) (built: Nov 11 2018 14:54:16) ( NTS ) # Copyright (c) 1997-2018 The PHP Group # Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
Start and enable PHP-FPM service:
sudo systemctl start php-fpm.service sudo systemctl enable php-fpm.service
Step 2 – Install MariaDB
Install MariaDB database server:
sudo yum install -y mariadb-server
Check the MariaDB version:
mysql --version # mysql Ver 15.1 Distrib 5.5.60-MariaDB, for Linux (x86_64) using readline 5.1
Start and enable MariaDB service:
sudo systemctl start mariadb.service sudo systemctl enable mariadb.service
Run mysql_secure installation script to improve MariaDB security and set the password for MariaDB root user:
sudo mysql_secure_installation
Answer all the questions as shown below:
Enter current password for root (enter for none): Set root password? [Y/n]: Y Remove anonymous users? [Y/n]: Y Disallow root login remotely? [Y/n]: Y Remove test database and access to it? [Y/n]: Y Reload privilege tables now? [Y/n]: Y
Log into MariaDB shell as the user root:
mysql -u root -p # Enter password<
Create a MariaDB database and user that you will use for your installation of InvoicePlane, and remember the credentials:
CREATE DATABASE dbname; GRANT ALL ON dbname.* TO 'username' IDENTIFIED BY 'password'; FLUSH PRIVILEGES;
Exit from MariaDB shell:
quit
Step 3 - Install NGINX
Install Nginx web server:
sudo yum install -y nginx
Check the NGINX version:
nginx -v # nginx version: nginx/1.12.2
Start and enable Nginx service:
sudo systemctl start nginx.service sudo systemctl enable nginx.service
Configure NGINX for InvoicePlane. Run sudo vim /etc/nginx/conf.d/invoiceplane.conf and populate the file with the following configuration:
server { listen 80; listen [::]:80; server_name example.com; root /var/www/invoiceplane; index index.php index.html; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ \.php$ { fastcgi_index index.php; try_files $uri =404; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass 127.0.0.1:9000; } }
Test the NGINX configuration:
sudo nginx -t
Reload NGINX:
sudo systemctl reload nginx.service
Step 4 - Install InvoicePlane
Download the latest stable version of InvoicePlane and extract the archive:
sudo mkdir -p /var/www cd /var/www sudo curl -O -J -L https://invoiceplane.com/download/v1.5.9 sudo unzip v1.5.9.zip sudo rm v1.5.9.zip sudo mv ip invoiceplane
Navigate to /var/www/invoiceplane
folder:
cd /var/www/invoiceplane
Make a copy of the ipconfig.php.example
file and rename the copy to ipconfig.php:
sudo cp ipconfig.php.example ipconfig.php
Open the ipconfig.php
file and add your URL in it:
sudo vim ipconfig.php # Something like this IP_URL=http://example.com
Change ownership of the /var/www/invoiceplane
directory to nginx:
sudo chown -R nginx:nginx /var/www/invoiceplane
Run sudo vim /etc/php-fpm.d/www.conf
and set the user and group to nginx
. Initially, they will be set to apache:
sudo vim /etc/php-fpm.d/www.conf # user = nginx # group = nginx
Run sudo vim /etc/php.ini
and set date.timezone:
date.timezone = Region/City
Restart the PHP-FPM service:
sudo systemctl restart php-fpm.service
Run the InvoicePlane installer from your web browser and follow the instructions:
http://example.com/index.php/setup
Once the installation has finished, you may log into InvoicePlane using the email address and password you have chosen during the installation.
If you want to secure your installation, you may disable the setup. To do so, replace the line DISABLE_SETUP=false
with DISABLE_SETUP=true
in your ipconfig.php
file.
Step 5 - Complete the InvoicePlane setup
InvoicePlane is now installed and configured, it's time to access their web installation wizard.
Open your web browser and type the URL http://example.com. You will be redirected to the following page:
Now, click on the Setup button. You should see the following page:
Next, choose the language and click on the Continue button. You should see the following page:
Next, click on the Continue button. You should see the following page:
Here, provide your database details and click on the Try Again button. You should see the following page:
Now, click on the Continue button. You should see the following page:
Now, click on the Continue button. You should see the following page:
Now, provide all the required details, then click on the Continue button. Once the installation is completed, you should see the following page:
Now, click on the Login button to access InvoicePlane administration.
Links
Di tulis oleh: admin