Install ERPNext on CentOS

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 7 on one of our optimized ERPNext hosting servers.

Prerequisites:

Make sure your server met the following requirements.

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

Update the System and Install the Dependencies

Log in to your server via SSH:

ssh [email protected]_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 development tool dependencies by running the following command:

sudo yum groupinstall -y "Development Tools"

Install ERPNext

Installing Node JS

Since ERPNext uses Node JS for its front end, we first need to set up the latest version of Node JS. As of writing, the current LTS version of Node.js is version 10.x.

To install, first, we need to run the following command to add NodeJS’ official repository to the system.

sudo curl -sL https://rpm.nodesource.com/setup_10.x | sudo bash -

Once the repository is added, run the following command:

sudo yum install -y nodejs

To verify, run the following to check node version, must be 10.x.x:

node --version

Installing ERPNext using a script

Fortunately, ERPNext developers have created an easy install script to save time and avoid any problems with configuring your ERPNext server. This python script will install the prerequisites & bench, as well as set up the ERPNext site.

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

To start with the installation, we first need to download the official script using wget:

wget https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py

The script will require three parameters:

domain = your development/production domain
erp_user = preferred local ERPNext user
bench_name = preferred bench name

For development installation, supply the following command.

sudo python install.py --develop --site [domain] --user [erp_user]--bench-name [bench_name] --verbose

For production installation, use the following command:

sudo python install.py --production --site [domain] --user [erp_user] --bench-name [bench_name] --verbose

An example would be:

sudo python install.py --develop --site erp-dev.rosehosting.com --user erpnext --bench-name erpnext-dev --verbose

The following is the process that will be done by the script:
* Install all the pre-requisites
* Install the command line based bench
* Set up a new bench – contains ERPNext files
* Finally, set up a new ERPNext site on the bench

During the installation, the script will ask for the database and Administrator password. Always remember to use a strong password. Passwords will be located at ~/passwords.txt after installation.

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_user]
cd [bench_name]
bench start

You can now access your setup at:

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

Production

There’s no need to do anything, processes will be managed by the supervisor.

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. You can learn more about supervisors here.

You can check processes handled by supervisor by using the command:

sudo supervisorctl status all

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.


Of course, you don’t have to install ERPNext on CentOS 7 if you have a CentOS VPS with us. You can simply ask our support team to install ERPNext on CentOS 7 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 7, feel free to share it on social networks using the shortcuts below, or simply leave a comment. Thanks.