</>CodeWithKarani
All articles

How To Install ERPNext in Ubuntu 20.04 - A Step by Step Guide

Kkarani3 min read
ERPNext installation can be a pain in the neck, especially if you are getting started. In this article, I will take a step-by-step approach to configure our newly installed ubuntu 20.04 OS to set up an environment and install ERPNext. We will not leave any stone un-turned here. Let's get to work!

Prerequisites

Software Requirements

  • Updated Ubuntu 20.04
  • A user with sudo privileges
  • Python 3.6+
  • Node.js 12
  • Redis 5
  • MariaDB 10.3.x / Postgres 9.5.x
  • yarn 1.12+
  • pip 20+
  • wkhtmltopdf (version 0.12.5 with patched qt)
  • cron
  • NGINX

Hardware Requirements

  • 4GB RAM
  • 40GB Hard Disk
In our first steps, we will make sure our system is up to date by running below commands:
$ sudo apt update
$ sudo apt -y upgrade
It is recommended to reboot your system whenever you do upgrade:
$ sudo reboot

Step 1: Install Python Tools & wkhtmltopdf

$ sudo apt -y install vim libffi-dev python3-pip python3-dev  python3-testresources libssl-dev wkhtmltopdf

Step 2: Install Curl, Redis and Node.js

$ sudo apt install curl

$ sudo curl --silent --location https://deb.nodesource.com/setup_14.x | sudo bash -

$ curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null
$ echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
$ sudo apt-get update && sudo apt-get install yarn
$ sudo apt -y install gcc g++ make nodejs redis-server

Step 3: Install Nginx web server and MariaDB Database server

$ sudo apt -y install nginx
$ sudo apt install mariadb-server
Change authentication plugin.
$ sudo mysql -u root
USE mysql;
UPDATE user SET plugin='mysql_native_password' WHERE User='root';
UPDATE user SET authentication_string=password('your_password') WHERE user='root';
FLUSH PRIVILEGES;
EXIT;
Ensure you have the following settings for mysqld and mysql client as provided. I have put a file on a public github repo, so you can copy and replace the whole file. 
$ sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
$ sudo systemctl restart mariadb

Step 4: Install Bench and ERPNext

A bench is a tool used to install and manage ERPNext on your Ubuntu system. We will create a user that will run the ERPNext system, then configure the system.
$ sudo useradd -m -s /bin/bash erpnext
$ sudo passwd erpnext
$ sudo usermod -aG sudo erpnext
Now it is time to update your PATH.
$ sudo su - erpnext
$ tee -a ~/.bashrc<<EOF
PATH=\$PATH:~/.local/bin/
EOF
$ source ~/.bashrc
Next, you need to create a directory for ERPNext setup and give erpnext user read and write permissions to the directory:
$ sudo mkdir /home/bench
$ sudo chown -R erpnext /home/bench
Next switch to erpnext user and install the application:
$ sudo su - erpnext
$ cd /home/bench
Install frappe bench and git
$ sudo apt install git

$ sudo pip3 install frappe-bench
The next step is to initialize the bench directory with frappe framework installed. Make sure you are still inside the /opt/bench directory:
$ bench init erpnext --frappe-branch version-13
Create a new Frappe site. $ cd erpnext $ bench new-site erp.codewithkaranicom-771722.ingress-alpha.ewp.live

Step 5: Get ERPNext application from GitHub

Download the ERPNext application from frappe Github repo. We will get version 13. You can get whichever version you like. $ bench get-app branch version-13 erpnext https://github.com/frappe/erpnext

Step 6: Install ERPNext App on our Site

$ bench --site erp.codewithkaranicom-771722.ingress-alpha.ewp.live install-app erpnext

Step 7: Start ERPNext and finish Installation

$ bench start
Navigate to the IP address of your installation and the port number shown on the terminal after running. In the case of a local instance, use 127.0.0.1:8000 https://youtu.be/Xnc3-2HPK6E
Keep reading

Related articles