ERPNext Install Ubuntu 20.04 – Manual Installation till Production Step by Step

In this guide, I have explained step by step from the Hardware to the ERPNext.

ERPNext Github

ERPNext and all frappe applications are available in the Github repository, you can clone or dowload from Github > Frappe> ERPNext

ERPNext Install Options

Though you can deploy ERPNext VM using OVA file where you don’t need to do any setup, simply, a ready-to-use appliance can be used. So you have 4 options to install ERPNext

  1. Deploy Appliance (VM) using OVA File

  2. ERPNext Docker Installation

  3. ERPNext Easy Installation

  4. ERPNext Manual Installation

In this article, we will learn how to do ERPNext Installation Manually on Ubuntu 20.04

ERPNext Manual Installation on Ubuntu 20.04 Step by Step

Now let us do manual Installation. This guide covers each and everything. Refer to the image and then you will understand the procedure;

ERPNext System Requirements

Hardware or VM, VPS on the cloud, the choice is yours, I deployed this on physical hardware, VM on Proxmox, VM on VMWare, and on Cloud as well. So the process is the same in all the cases the specifications for hardware that I have chosen is below;

Number of Concurrent Users

100

Processor

2 vCPUs

RAM

8GB

Storage

100GB

Ubuntu Server Installation

Now you can install the ubuntu server, enable the terminal, complete the networking and make the server ready to be deployed. You can read the guide to do Ubuntu Server Installation Step by Step

The user that I have chosen it amjid for the installation and I will be using the same user for ERPNext Installation as well.

To Join Full Course click : ERPNext Installation Step by Step

Update and Upgrade Ubuntu Server

It is always a good idea to upgrade the Ubuntu package if anything is available, run the below command to upgrade and update

sudo apt update && sudo apt -y upgrade -y

It is always recommended to reboot the server once the upgrade is done.

sudo reboot

Install Pre-Requisites

You will need to install all the prerequisites that include tools and applications like git, python, node js, Redis, MariaDB, yarn wkhtmltopdf, cron, and Nginx. let us install all of them by using the below commands;

Install GIT, this will be used to clone the repository from GitHub

apt install git

python-dev contains the header files so we need to install this package on ubuntu server

apt install python-dev

Let us now install a tool for installing and managing Python3 Packages, the current version of python is 3, so we will be specific while installing this package, use the below command.

apt install python3-pip

Resid can be used to process and analyze data in memory, this is prerequisite for ERPNext.

apt install redis-server

Now install the below package to manage the repository, usually, Ubuntu 20.04 has already installed it, but for the safe side, we will run this command.

apt-get install software-properties-common

Now let us install another tool which is a pre-requisite for ERPNext, these tools include X virtual frame buffer, custom font, and a tool that is used to render HTML to PDF.

apt-get install xvfb libfontconfig wkhtmltopdf

Now let us take a break and reboot the server

sudo reboot

Database Installation & Configuration

You can now install the database, I will be using the same server for the database and application, which is recommended. Let us see how to install, secure and configure the database service on Ubuntu Server for ERPNext.

Install MariaDB Server and Client

Now we will first install the MariaDB server and Mardia DB client. Though you can use MySQL but we will be using MariaDB for reliability and better performance.

sudo apt-get install mariadb-server-10.3
sudo apt-get install mariadb-client-10.3​

Now the client and server are installed, let us now secure the installation, make sure to chagne the root password and follow the steps, depending upon how you want to secure it.

sudo mysql_secure_installation​

MySQL Development files can be installed using the below command

sudo apt-get install libmysqlclient-dev​

MariaDB Configuration File

You need to ensure to change the default character set of MySQL or MariaDB to Unicode instead of general. To do this you will need to edit the maria DB configuration file which is in this version located at /etc/mysql/mariadb.conf.d directory so you can directly edit this or locate the folder and then edit the file by typing the below command

sudo nano /etc/mysql/maridb.conf.d/50-server.cnf​

Once the file opens you need to locate the line where collation-server says general and you need to modify it to Unicode as below;

collation-server = utf8mb4_general_ci

Modify above as below;

collation-server = utf8mb4_unicode_ci​

You can also locate my.cnf and edit the below configuration.

sudo nano nano /etc/mysql/my.cnf

Make sure your configuration has the below lines in the file

[mysqld] ​

character-set-client-handshake = FALSE​
character-set-server = utf8mb4 ​
collation-server = utf8mb4_unicode_ci ​

[mysql] ​
default-character-set = utf8mb4​

MySQL Native Password Setup

Now you must ensure that the native password is configured, which will help the frappe framework automatically create the database when you create the site. For this, you will need to login to MySQL as root and then update the root user or the user that you want to use. I will be using root for my installation so use the below commands

 mysql -u root -p

Now enter the password set a native password by using the below commands.

mysql> USE mysql;
mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root';​
mysql> FLUSH PRIVILEGES;
mysql> exit

Now MySQL or MariaDB setup is now ready, let us now restart eh service. You can alternatively reboot as well.

sudo service mysql restart

Install Node Using NVM

Node installation is recommended using NVM (Node Version Manager) therefore let us first install NVM. To install NVM use the below command.

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash

Now at this step close the termination and open it again. Or open a new terminal to continue with the next step. Ensure you do it. Once you have done run the below command to install the node

nvm install 14

Now it has been installed you can now check the version by typing the below command

node -v

Install Yarn using NPM

Now we will install Yarn which is a software packaging system developed by Facebook for Node.js, this is open source, so we will install it using npm

npm install -g yarn

Now our server is ready for the installation of the frappe environment, let us now dive into the frappe environment installation.

Bench Installation

The bench is a Command-line tool to manage Frappe Deployments, this tool has various commands, the frappe uses the bench for the command-line tool as well as for the bench directory, so don’t confuse yourself. We will first install the bench package which will be used to set up a frappe environment, create a site, do backup, change the setup, and so on. In short, Bench provides a user-friendly interface to set up and manage multiple frappe-based applications and sites where erpnext is one of the applications.

Now let us install the bench;

pip3 install frappe-bench​

It will install a bench and will give you a message that the bench is installed successfully, now you can use various bench commands. Starting with the command “bench”

Install Frappe-Bench Environment using bench CLI

Let us now create the frappe-bench environment. Here you have to decide the purpose for which you are installing ERPNext, it is just for test or training then you can use the latest version, which will be developing and may not be stable. However you can also use a stable version by choosing a specific version, You can search and learn which is the stable version today.

To deploy the latest frappe-bench environment make sure to run the command while you are in your home directory or your user and use the below command.

bench init frappe-bench​

To choose a specif version you can use the branch version. I will be using branch version 13 in this installation. You can look for the latest stable release of the frappe environment.

bench init frappe-bench --verbose --frappe-branch version-13

Now frappe bench environment is installed using bench CLI. It has in fact created a directory in the home as shown below;

frappe-bench

You can also see the directory in WINSCP this directory contains various files to run frappe environment

frappe-bench files

Now you can use various bench commands by changing the directory. So you can need to change the directory

cd frappe-bench

Once you type bench you will see the various commands that bench cli has. Don’t worry, we will not be using all the commands, we just need to install EPRNext but have a quick look at these commands.

frappe-bench commands

To start bench you can type the command

bench start

just wait for it, it will start the bench and you will see that it will give you information saying that the server is now running at port 8000. Now you can open the server in the browser with port 8000.

You will give nothing on-page, it will say page not found.

Because we have installed the environment, we have not yet created any site in the environment.

Frappe Environment has Applications and Sites. When you install frappe-bench one application (default) frappe will be available for you to install on any site.

If you just want to install the application with no modules you can do that, but we have to install ERPNext. Below will help you to;

  • get the ERPNext app

  • create a new-site for your ERP Installation

  • Install the ERPNext app on site created.

ERPNext Installation on Frappe Environment

make sure that your working directory is frappe-bench it should look like this

Now you need to get the app from the frappe repository, have two options, either clone the latest development package, which is not stable currently, or install the stable package. I have given both options for you to choose from.

To install the current package which is not stable you can use the below command

bench get-app erpnext https://github.com/frappe/erpnext​

I will be installing ERPNext Version 13, for that, I will be using the below command

bench get-app --branch version-13 erpnext

From any of the options, it will clone the next application into the app’s directory of the frappe-bench directory. You don’t need to do anything with the directories. Just ensure that erpnext is available in the directory.

Now you have the application installed in your environment. The next step is to install the application on-site, but before that, we need to create a new site.

To create a site we will use the bench command as below;

bench new-site erp.syncbricks.com​

make sure to change the site name to your required site name.

Now site is deployed, by default frappe application will be installed at site. Don’t open the site yet, because we need to install ERPnext to the site.

Run the below command to install ERPNext to the site that you have recently created

bench --site erp.syncbricks.com install-app erpnext​

it will take a few moments to install the erpnext application on your site.

Now as we created a new site, we need to make sure this is our default site, so we have to tell bench to use this site as default by using the below command;

bench use erp.syncbricks.com

Now ERPNext is installed in your server and you are ready to configure it. But beofre configuring there are few more steps in case you want o use this for production.

ERPNext Setup for Production

We will use a manual bench set up for production by using the below command.

sudo bench setup production amjid

Setup Bench Supervisor

sudo apt -y install supervisor
bench setup supervisor
sudo ln -s `pwd`/config/supervisor.conf /etc/supervisor/conf.d/frappe-bench.conf​

in case the supervisor is not installed you can use the below command

Setup Bench NginX

bench setup nginx
sudo ln -s `pwd`/config/nginx.conf /etc/nginx/conf.d/frappe-bench.conf​

Now you will get a message saying that erp.sncbricks.com is on port 80

You can simply open the browser and open the URL of the installation it will work fine.

ERPNext SSL Installation NginX

Now your site is ready, you must configure the SSL certificate, I have explained that in simple steps.

First, we will install spanny package as below

sudo apt install snapd​

Now run the below commands

sudo snap install core; sudo snap refresh core​

install remove certbot

sudo apt-get remove certbot​

Install classic cert bot

​sudo snap install --classic certbot​

Map the directory for cert path

sudo ln -s /snap/bin/certbot /usr/bin/certbot​

Now run the below command to install the certificate to your site. Make sure you have the public address of the site and that port 80 is open. If this address is local make sure the site address is pointing to the correct IP address.

sudo certbot -–nginx​

Just follow the instructions, and it will install the certificate. Your site will be redirected to port 443.

The configuration is available in the config directory and the file name is nginx.conf which will have the ssl details at the end of the file.

Finally, ensure that the certificate gets renewed before expiry, you can run the below command to renew it.

sudo certbot renew --dry-run

Add this command to the cronjob to ensure the certificate gets renewed automatically, schedule it every week.

ERPNext Backup

ERPNext in Production Automatically takes the 3 backups by default. And cronjob runs the backup Jobs Automatically. You can access the backup settings by clicking System Settings > Backup.

To configure the backup you can use crontab.

ERPNext mobile app

ERPNext is a responsive website which means you can access it on mobile without the need of any app

ERPNExt Pricing

ERPNext is an open-source software, if you want to install, configure and implement it by yourself then you can use it always free however prices can be below;

Did you find this article valuable?

Support Itanand's Blog by becoming a sponsor. Any amount is appreciated!