How to set up Frappe Framework and install ERPNext in Ubuntu 22.04 – A step-by-step guide

Welcome to CodeNet, In this tutorial I am going to explain the frappe framework and the step by step to install it. Ok, let’s get started. I am working on the Frappe Framework for the past 1 year and I faced many problems over that period. I’m going to share my experience and issues faced in Frappe and ERPNext.

About Frappe Framework

Frappe, pronounced fra-pay, is a full stack, batteries-included, web framework written in Python and Javascript with MariaDB as the database. It is the framework which powers ERPNext, is pretty generic and can be used to build database driven apps.

Follow the below steps to install Frappe Framework:

Prerequisites

You should have the below-mentioned prerequisites installed to run Frappe Framework and other apps smoothly.

Requirements

Software RequirementsHardware Requirements
Updated Ubuntu 22.04
A user with sudo privileges
Python 3.10+
Node.js 16
Minimum 4GB RAM
Minimum 40GB Hard Disk

Server Settings

After installing your Ubuntu Server 22.04 or 20.04.X do the below steps

Setup correct Date and Timezone

Check the server’s current timezone

date

Check the List of Available Timezone

timedatectl list-timezones

Set correct timezone as per your region, Need more help in setting Timezone check here.

timedatectl set-timezone "Asia/Kolkata"

Update and Upgrade Packages

Update and Upgrade the package list using the below commands.

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

Create a new user for the bench

Don’t use the user which you created while installing Ubuntu and Don’t use the root user. Please create a new user called Frappe and use it for Frappe Bench.

*** Please replace [frappe-user] with the user username. (Eg. sudo adduser frappe or sudo adduser codenet )***

sudo adduser frappe
sudo usermod -aG sudo frappe
su frappe
cd /home/frappe

Installing Required Packages

Frappe Framework and Apps like ERPNext, HRMS, and Payments are developed using many libraries and tools. Install the below apps to run Frappe Framework smoothly.

Install Git

sudo apt-get install git -y

Install Python

Frappe and ERPNext version 14 need Python version 3.10+. Install it by following the below step.

sudo apt-get install python3-dev python3.10-dev python3-setuptools python3-pip python3-distutils -y

Install Python Virtual Environment

Python Virtual Environment is a powerful tool that enables developers to create self-contained environments for their Python projects.

sudo apt-get install python3.10-venv -y

Install Software Properties Common

Software Properties Common is used from the command line, which allows users to add new repositories or PPAs (Personal Package Archives) to their system.

sudo apt-get install software-properties-common -y

Install MariaDB

sudo apt install mariadb-server mariadb-client -y

Frappe and ERPNext are using MariaDB to store the Data.

Install Redis Server

sudo apt-get install redis-server -y

Install Other Packages

The following packages will provide functionality for loading fonts, PDFs and so on in our instance.

sudo apt-get install xvfb libfontconfig wkhtmltopdf -y && sudo apt-get install libmysqlclient-dev -y

Configure MYSQL Server

SQL Setup

sudo mysql_secure_installation

This command will show the following prompts which are used to configure our MYSQL. Please follow the steps as shown below.

  • Enter current password for root: (Enter your SSH root user password)
  • Switch to unix_socket authentication [Y/n]: Y
  • Change the root password? [Y/n]: Y
    It will ask you to set a new MySQL root password at this step. This can be different from the SSH root user password.
  • Remove anonymous users? [Y/n] Y
  • Disallow root login remotely? [Y/n]: Y
    This is set as Y because of security. If you want to access the database from a remote server using business analytics software like Metabase / PowerBI / Tableau, etc., you can create a new user by following this tutorial.
  • Remove the test database and access to it? [Y/n]: Y
  • Reload privilege tables now? [Y/n]: Y

Configure MYSQL file

sudo nano /etc/mysql/my.cnf

Add the below config to the editor(Don’t change Anything in the syntax)

[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci

[mysql]
default-character-set = utf8mb4

Restarting MYSQL Server

sudo service mysql restart

Instal cURL, Node, NPM and Yarn

Install cURL

sudo apt install curl

Install Node

curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
source ~/.profile
nvm install 16.15.0

Install NPM

sudo apt-get install -y npm

Install Yarn

sudo npm install -g yarn

Install Frappe Bench

Installing Frappe Bench(A command-line interface tool used to install, manage, and deploy Frappe and ERPNext applications).

sudo pip3 install frappe-bench

Initialize Frappe Bench

bench init --frappe-branch version-14 frappe-bench

Change to Frappe Bench directory

cd frappe-bench

Change user directory permissions

This will give the bench user execution permission to the home directory.

sudo chmod -R o+rx /home/frappe

Create New Site

A site is where all the Apps like Frappe, ERPNext, Payments and others will install. So first create a site.

bench new-site [site-name]

Install ERPNext and other Apps

Download the apps

Let’s download the Apps which you want to install on your site. First I’m downloading ERPNext.

bench get-app --branch version-14 erpnext

If you wants to install specific version try the below( bench get-app erpnext --branch v14.31.3 )

By following the same you can download whatever apps you want. Find the list of Apps available for Frappe here.

bench get-app payments
bench get-app --branch version-14 hrms
bench get-app --branch version-14 https://github.com/resilient-tech/india-compliance.git

Install the apps on the site

Once you downloaded the apps install them one by one on your site.

bench --site [site-name] install-app erpnext
bench --site [site-name] install-app hrms

Start the Bench

By using this command, you can serve your Frappe App and you can access it through the Web Browser. By default, it will run in http://<Your-Server-IP>:8000.

bench use [site-name]

This will set your current site. Then start the bench.

bench start

Note: Now the instance will is run in developer mode, which means always your terminal should be kept open.

Setting ERPNext for Production

The following process is for making a production environment. Once you enabled it, whenever you restart your bench will automatically start running.

Enable Scheduler

bench --site [site-name] enable-scheduler

Disable maintenance mode

bench --site [site-name] set-maintenance-mode off

Setup production config

sudo bench setup production frappe

Setup NGINX

The next step will prompt you to save the existing config file, You should respond with Y

bench setup nginx

Restart Supervisor and Launch Production Mode

sudo supervisorctl restart all

The next step will prompt you to save the existing config file, You should respond with Y

sudo bench setup production frappe

Well Done, You have successfully installed Frappe and ERPNext in Ubuntu Server 22.04. Now you can access your Web App in your Server IP like (http://0.0.0.0) without mentioning the port as 8000.

Note: If you are facing any error in the above process, you can post in the comments.

Leave a Comment

Scroll to Top