How to Install ERPNext on Ubuntu 18.04

How to Install ERPNext on Ubuntu 18.04

ERPNext is an open-source Enterprise Resource Planning (ERP) framework designed around hassle-free web-based business process management. ERPNext features include Accounting, HR & Payroll, Manufacturing, Sales & Purchase, CRM, Projects, Help Desk, Asset Management, and a fully functional website.

The ERPNext core is developed using the Python programming language. It also makes use of mainstream platforms such as Nginx, MariaDB, Node.js, and Redis, which make it up-to-date with the latest trends and is likely to be supported in the years to come.

ERPNext is licensed under the GNU General Public License v3.

In this tutorial, we will show you how to install ERPNext on Ubuntu 18.04 on one of our optimized ERPNext hosting servers.

Prerequisites:

Make sure your server meets the following requirements:

  • 2 or more CPU cores
  • 2GB of RAM or higher
  • Fresh Ubuntu 18.04 Installation
  • Full root access

Update And Install the System Packages and Dependencies

Log in to your server via SSH:

ssh username@server_ip

It is always recommended to update the system packages to their latest versions.

apt-get update && apt-get upgrade -y

Install the build tool dependencies by running the following command:

apt-get install software-properties-common build-essential python3-minimal python3-setuptools python3-dev -y

Install ERPNext

Installing Node.js

ERPNext uses Node.js for its frontend. Currently, the LTS version of Node.js is version 12.x, which is supported until April 2022.

First, we need to activate the official script that will help us add the official repository for Node.js on our Ubuntu 18.04 machine.

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -

It will automatically run “apt-get update” for us. After updating, we may now install the Node.js package using this command:

apt-get install -y nodejs

To verify if the installation is a success, run the following to check installed Node.js version:

node --version

Installing MariaDB

Run the following commands to import the MariaDB GPG key and install MariadDB 10.3 version:

apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
add-apt-repository 'deb [arch=amd64] http://ftp.utexas.edu/mariadb/repo/10.3/ubuntu bionic main'
apt-get update
apt-get install mariadb-server
systemctl start mariadb
systemctl enable mariadb
mysql_secure_installation

Continuing ERPNext installation

ERPNext developers have created a Python-based script that will help us save time and avoid common problems when configuring our ERPNext server. This script will automatically install and set up all prerequisites by just providing certain parameters. Note that we can set up ERPNext in two environments: development, or production.

For a development environment setup, services must be started manually. It will also require the use of port (8000) when accessing the ERPNext installation.

For a production environment setup, all services like Nginx, MariaDB, Redis, and others are managed by Supervisor. Supervisor is a process control system that enables you to monitor and control services on your Ubuntu 18.04 installation. As it is running in the background and continuously checking the status of your services, it will automatically handle all process failures by rebooting the services in case it crashes. It will also manage the start, stop, and restart of ERPNext required services.

Supervisor will be configured automatically by the ERPNext install script.

Setting up ERPNext

Stop and disable Apache service if it is running on your server:

systemctl stop apache2.service
systemctl disable apache2.service

We first need to download the official Python install script from ERPNext’s official GitHub repository:

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

The install script will require three parameters:

domain = Fully Qualified Domain Name
erp_user = Chosen local ERPNext user
bench_name = Chosen bench name

Run the following command:

export LC_ALL=C.UTF-8

For a development installation, supply the following command:

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

For a production installation, use the following command:

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

An example would be:

python3 install.py --production --site erp-prod.yourdomain.com --user erpnext --bench-name erpnext-prod --verbose

The Python install script will do the following:

  • Install all required packages and libraries
  • Install the command line-based bench
  • Create a new bench which contains ERPNext files and assign an ERPNext user
  • Create a new ERPNext site on the bench using the domain parameter provided

During installation, it will ask for a MySQL and ERPNext Administrator password. Remember to always use a strong password.

Starting ERPNext

For a Development Environment

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

su - [erp_user]
cd [bench_name]
bench start

You may now access your website’s initial setup at:

http://[yourdomain]:8000
Login: Administrator
Password: The one that you provided during installation

For a Production Environment

Processes will be managed by the Supervisor daemon, so there is nothing to configure. You can check processes handled by the Supervisor by using the command:

supervisorctl status all

You should see the following services handled by Supervisor:
erpnext-prod-redis:erpnext-prod-redis-cache RUNNING pid 5293, uptime 0:16:54
erpnext-prod-redis:erpnext-prod-redis-queue RUNNING pid 5294, uptime 0:16:54
erpnext-prod-redis:erpnext-prod-redis-socketio RUNNING pid 5295, uptime 0:16:54
erpnext-prod-web:erpnext-prod-frappe-web RUNNING pid 5488, uptime 0:16:47
erpnext-prod-web:erpnext-prod-node-socketio RUNNING pid 5487, uptime 0:16:47
erpnext-prod-workers:erpnext-prod-frappe-default-worker-0 RUNNING pid 5464, uptime 0:16:48
erpnext-prod-workers:erpnext-prod-frappe-long-worker-0 RUNNING pid 5465, uptime 0:16:48
erpnext-prod-workers:erpnext-prod-frappe-schedule RUNNING pid 5463, uptime 0:16:48
erpnext-prod-workers:erpnext-prod-frappe-short-worker-0 RUNNING pid 5466, uptime 0:16:48

Finalizing ERPNext Installation

You may now log in to your production website directly without port 8000, since Nginx has been configured as a reverse proxy.

The Nginx config can be found at /home/[erp_user]/[bench_name]/config/nginx.conf

After a successful login, you can then proceed with the initial setup of your ERPNext application.

That’s it! You now have a working ERPNext server on your Ubuntu 18.04 VPS.


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

If you’ve already switched to Ubuntu 20.04 and are having problems setting up ERPNext, you can check out our article on how to install ERPNext on Ubuntu 20.04.

If you enjoyed reading this blog post on How to Install ERPNext on Ubuntu 18.04, feel free to share it on social networks using the shortcuts below, or simply leave a comment in the comments section. Thanks.

Leave a Comment