How To Install ERPNext on CentOS 8

how to Install erpnext on centos 8
install erpnext on centos 8

ERPNext is a completely robust ERP framework intended for small and medium-sized businesses. It covers an extensive variety of features, including accounting, CRM, inventory, selling, purchasing, manufacturing, projects, HR and payroll, website, e-commerce, and more – all of which make it profoundly adaptable and extendable.

ERPNext is developed in Python and depends on the Frappe Framework. It utilizes Node.js for the front end, Nginx for the web server, Redis for caching, and MariaDB for the database.

ERPNext is Open Source under the GNU General Public License v3.

In this article, we will show you how to install ERPNext on CentOS 8 on one of our optimized ERPNext hosting servers.

Prerequisites:

Make sure your server meets the following requirements.

  • 2GB of RAM or higher
  • 2 or more CPU cores
  • Fresh CentOS 8 Installation
  • Full root access

Prepare and Update the System and Install the Dependencies

Log in to your server via SSH:

ssh username@server_ip

Before starting with the ERPNext installation, it is a good idea to update the system packages to their latest versions.

sudo yum update -y

Install the extra packages repository:

sudo yum install -y epel-release

We can set up ERPNext on two environments, development and production. For the development environment, there will be no Nginx installed and you need to start ERPNext manually. For a production environment,  Nginx is installed and the process will be managed by supervisor. You will learn more about supervisor later on in this tutorial.

When installing under a production environment, we need to make sure that we uninstall Apache first as the installer script will set up Nginx. It is also recommended to uninstall MariaDB to avoid conflicts during installation for both production and development. For a development environment, it is safe to leave Apache installed and running as Nginx will not be installed.

To stop and uninstall Apache (required for production set up only):

sudo systemctl stop httpd
sudo yum remove -y httpd httpd-tools apr apr-util

To stop and uninstall MariaDB (recommended for both development and production setup):

sudo systemctl stop mariadb
sudo yum remove -y mariadb mariadb-server
sudo rm -rf /var/lib/mysql /etc/my.cnf

Install the required packages along with MariaDB, Nginx, NodeJS, redis:

sudo yum install -y gcc make git mariadb mariadb-server nginx supervisor python3 python3-devel python2 python2-devel redis nodejs

Install Yarn Package Manager:

sudo npm install -g yarn

Disable SELinux

In order to avoid setting up complex SELinux rule-set we would need to disable it. Disabling SELinux on CentOS 7 is fairly easy task. You can do that with one command:

echo 0 > /selinux/enforce

As an alternative you can use the following command:

setenforce 0

Now, check the status again and make sure it is disabled.

Please note, this will disable SELinux only temporarily. If you want to disable it permanently, you will need to perform the following steps:

Open the /etc/sysconfig/selinux file for editing with a text editor of your choice. We will be using vim in the example below.

vim /etc/sysconfig/selinux

Once you open the file change the following line:

SELINUX=enforcing

to

SELINUX=disabled

Then save and close the file.

Install ERPNext

Creating ERPNext user

Once we have installed the required packages we can start with the installation of ERPNext.

We would need an user that will be dedicated to the ERPNext instance and it will have sudo access:

sudo useradd -m erp -G wheel

The default sudo settings require us to enter the password when we issue the command. You can avoid that with:

sudo sed -i 's/^#\s*\(%wheel\s\+ALL=(ALL)\s\+NOPASSWD:\s\+ALL\)/\1/' /etc/sudoers

We need to set additional kernel parameters:

echo "vm.overcommit_memory = 1" | sudo tee -a /etc/sysctl.conf
echo "echo never > /sys/kernel/mm/transparent_hugepage/enabled" | sudo tee -a /etc/rc.d/rc.local
sudo chmod 755 /etc/rc.d/rc.local

We need to do a reboot so the kernel settings can take an effect.

Configure MariaDB (MySQL fork) for ERPNext

Unlike other ERP applications , ERPNext supports MariaDB in order to store the persistent part of the data. Previously we installed the latest available version of MariaDB for CentOS 8 and now we need to configure it for ERPNext.

Create a config file for ERPNext for MariaDB:

cat <<EOF >/etc/my.cnf.d/erpnext.cnf

[mysqld]

innodb-file-format=barracuda innodb-file-per-table=1 innodb-large-prefix=1 character-set-client-handshake = FALSE character-set-server = utf8mb4 collation-server = utf8mb4_unicode_ci

[mysql]

default-character-set = utf8mb4 EOF

Enable and start the MariaDB service:

sudo systemctl enable mariadb
sudo systemctl start mariadb

Start the MariaDB secure installation script (make sure you remember the MariaDB root password). Also, always use a strong passwords if asked:

sudo mysql_secure_installation

Install ERPNext

We will install ERPNext under the new user that we have created, erp.

Change to the ERPNext user and change the working directory to its home directory:

su - erp

Install frappe-bench with pip3 and initialize version-12:

pip3 install --user frappe-bench
bench init frappe-bench --frappe-branch version-12

When the initialization is done, you will get the following message:

SUCCESS: Bench frappe-bench initialized

With the initialized frappe-bench we can create new frappe site for our ERPNext instance.

We need to start the frappe development server:

cd frappe-bench
sed -i '/web:/ s/$/ --noreload/' Procfile
bench start >/tmp/bench_log &

We need to create a new site with our domain/subdomain name:

bench new-site erp.rosehosting.com

We will receive a prompt for the MySQL password that we have entered earlier. Enter the MySQL root password.

Now we are ready to download and install ERPNext via bench.

First download the latest ERPNext version with bench:

bench get-app erpnext --branch version-12

Once downloaded install it:

bench install-app erpnext

Now we are ready to start and to use ERPNext

Starting ERPNext

On a development environment setup, it is required to start the ERPNext application manually. The ERPNext application listens on port 8000.

Development

su - erp
cd frappe-bench
bench start >/tmp/bench_log &

You can now access your setup at:

http://[domain]:8000
Login: Administrator
Password: The one that you input during installation

Production

At some point of time we would want ERPNext in production mode.

For that we would need to create production files for supervisor and nginx:

su - erp
cd frappe-bench
bench setup supervisor
bench setup nginx

Add a link of the newly created configuration files to their respective services:

sudo ln -s `pwd`/config/supervisor.conf /etc/supervisord.d/frappe-bench.ini
sudo ln -s `pwd`/config/nginx.conf /etc/nginx/conf.d/frappe-bench.conf

Change the nginx process owner to be erp by editing /etc/nginx/conf/nginx.conf and changing the user directive to:

user erp erp;

Supervisor is a process control system that enables you to monitor and control processes on systems running Linux. When supervisor is running, it will automatically start the application at boot and will handle process failures. The installer script automatically configured supervisor for your ERPNext application.

Now you can enable and start both supervisor and Nginx:

sudo systemctl enable supervisord
sudo systemctl start supervisord
sudo systemctl enable nginx
sudo systemctl start nginx

You can now log in to your production website without using port 8000 as the Nginx web server is already configured as a reverse proxy for port 8000.

After logging in, you should now be able to finalize the initial setup of your ERPNext application.


install erpnext on centos 8

Of course, you don’t have to install ERPNext on CentOS 8 if you have a ERPNext VPS with us. You can simply ask our support team to install ERPNext on CentOS 8 for you. They are available 24/7 and will be able to help you with the installation.

PS. If you enjoyed reading this blog post on How to Install ERPNext on CentOS 8, feel free to share it on social networks using the shortcuts below, or simply leave a comment. Thanks.

Leave a Comment