How to Install InvoicePlane with Nginx on Fedora 29
InvoicePlane is a free and open source invoicing application. Its source code can be found on this Github. This tutorial will show you how to install InvoicePlane on a fresh Fedora 29 system.
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 Fedora 29.
- A non-root user with sudo privileges.
Initial steps
Check your Fedora system version:
cat /etc/fedora-release
# Fedora release 29 (Twenty Nine)
Set up the timezone:
timedatectl list-timezones
sudo timedatectl set-timezone 'Region/City'
Update your operating system packages (software). This is an important first step because it ensures you have the latest updates and security fixes for your operating system's default software packages:
sudo dnf upgrade -y
Install some essential packages that are necessary for basic administration of the Fedora operating system:
sudo dnf install -y vim wget curl git socat unzip bash-completion
Step 1 - Install PHP and required PHP extensions
InovicePlane web application requires PHP version 7.0 or greater.
Install PHP, as well as the necessary PHP extensions:
sudo dnf install -y php-cli php-fpm php-common php-gd php-json php-mbstring php-mcrypt php-mysqlnd php-xmlrpc php-recode
To show PHP compiled in modules, you can run:
php -m
ctype
curl
exif
fileinfo
. . .
. . .
Check the PHP version:
php --version
# PHP 7.2.16 (cli) (built: Mar 5 2019 11:05:59) ( 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:
sudo dnf install -y mariadb-server
Check the MariaDB version:
mysql --version
# mysql Ver 15.1 Distrib 10.3.12-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
Replace dbname, username, and password with your own names.
Step 3 - Install NGINX
Install Nginx web server:
sudo dnf install -y nginx
Check the NGINX version:
nginx -v
# nginx version: nginx/1.14.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$ {
include default.d/php.conf;
fastcgi_index index.php;
try_files $uri =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass /var/run/php-fpm/www.sock;
}
}
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
directory:
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 DISABLE_SETUP=false
line 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 its 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.