How to Install ERPNext v15 on Ubuntu 22.04

Step-by-Step Instructions for Installation of ERPNext version 15 on Ubuntu 22.04
September 21, 2024 by
How to Install ERPNext v15 on Ubuntu 22.04
Hamed Mohammadi
| No comments yet

Introduction to ERPNext

ERPNext is a comprehensive, open-source enterprise resource planning (ERP) system designed to manage every aspect of a business, from accounting and inventory to human resources and customer relationships. Built on the robust Frappe Framework, ERPNext provides a modular, highly customizable platform that caters to businesses of all sizes. Its flexibility and ease of use make it an ideal solution for organizations looking to streamline their operations and improve productivity without the high cost associated with proprietary ERP solutions.

What sets ERPNext apart is its commitment to simplicity and accessibility. With a clean user interface and a wide range of built-in features, it enables businesses to automate tasks, integrate processes, and gain insights through comprehensive reporting. From manufacturing and retail to healthcare and education, ERPNext supports various industries and scales effortlessly with the growth of your business.

Furthermore, ERPNext’s open-source nature allows for significant customization and integration with third-party applications, making it adaptable to specific business needs. Its community-driven development ensures that users receive continuous improvements, security updates, and access to a wide range of resources and support.

In this guide, we will walk you through the step-by-step process of installing ERPNext v15 on a Linux Ubuntu server, enabling you to take full advantage of its features to optimize your business operations.



PRE-REQUISITES:

We need a minimal installation of an Ubuntu server on a VPS with this requirements:

  • Operating System: Linux Ubuntu 22.04 LTS

  • Minimum Recommended Hardware: 2 CPU | 4 GB RAM | 20 GB Disk

  • Root shell access to the server (via SSH)

1 SERVER SETUP

First we need to preferred the server with requirements and dependencies.

1.1 Login to the server as root user

1.2 Setup the correct date and timezone (important step as it impacts ERPNext usage)

date  # Check the server’s current timezone
timedatectl set-timezone "Asia/Kolkata"  # Set the correct timezone as per your region

1.3 Update & upgrade server packages

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

1.4 Create a new user for security purposes

sudo adduser [frappe-user]
sudo usermod -aG sudo [frappe-user]
su [frappe-user] 
cd /home/[frappe-user]/

Replace [frappe-user] with your preferred username. For example, sudo adduser frappe.

2 INSTALL REQUIRED PACKAGES

We need to install git to clone required repositories.

2.1 Install Git

sudo apt-get install git

Check if Git is correctly installed by running:

git --version

2.2 Install Python

Install required Python packages using the following command:

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

2.3 Install Python Virtual Environment

Also install Python virtual environment:

sudo apt-get install python3.10-venv

Check if Python is correctly installed by running:

python3 -V

2.4 Install Software Properties Common (for repository management)

sudo apt-get install software-properties-common

2.5 Install MariaDB (MySQL server)

ERPNext is currently using MariaDB. It is expected to move this to PostgreSQL in the future. So we need to install MariaDB:

sudo apt install mariadb-server mariadb-client

Check if MariaDB is correctly installed by running:

mariadb --version

2.6 Install Redis Server

sudo apt-get install redis-server

2.7 Install other necessary packages (for fonts, PDFs, etc.)

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

3 CONFIGURE MYSQL SERVER

We should secure our mysql installation and also add some configuration suitable for ERPNext.

3.1 Setup the server

sudo mysql_secure_installation

Follow the prompts and choose appropriate options:

  • Enter root password

  • Switch to unix_socket authentication: Y

  • Change the root password: Y

  • Remove anonymous users: Y

  • Disallow root login remotely: N

  • Remove test database: Y

  • Reload privilege tables: Y

3.2 Edit MySQL config file

sudo vim /etc/mysql/my.cnf

Add the following code block at the bottom of the file:

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

[mysql]
default-character-set = utf8mb4

3.3 Restart MySQL

sudo service mysql restart

4 INSTALL CURL, NODE, NPM, AND YARN

4.1 Install CURL

sudo apt install curl

4.2 Install Node

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

4.3 Install NPM

sudo apt-get install npm

4.4 Install Yarn

sudo npm install -g yarn

Verify installations:

node --version
npm --version
yarn --version

5 INSTALL FRAPPE BENCH IN VIRTUAL ENVIRONMENT

5.1 Create a Virtual Environment

Navigate to the user's home directory:

cd /home/[frappe-user]/

Create and activate a virtual environment:

python3 -m venv .venv
source .venv/bin/activate

5.2 Install Frappe Bench

Inside the virtual environment, install Frappe Bench:

pip install frappe-bench

Verify the installation:

bench --version

5.3 Initialize Frappe Bench

bench init --frappe-branch version-15 frappe-bench

Navigate to the bench directory:

cd frappe-bench/

5.4 Change directory permissions

chmod -R o+rx /home/[frappe-user]/

5.5 Create a New Site

bench new-site site1.local

6 INSTALL ERPNext AND OTHER APPS

6.1 Download the necessary apps

bench get-app payments
bench get-app --branch version-15 erpnext
bench get-app hrms  # Optional

6.2 Install the Apps

bench --site site1.local install-app erpnext
bench --site site1.local install-app hrms  # Optional

7 SETUP PRODUCTION SERVER

7.1 Enable scheduler

bench --site site1.local enable-scheduler

7.2 Disable maintenance mode

bench --site site1.local set-maintenance-mode off

7.3 Setup production config

bench setup production [frappe-user]

7.4 Setup NGINX

bench setup nginx
sudo service nginx reload

7.5 Final server setup

sudo supervisorctl restart all

8 CUSTOM DOMAIN & SSL SETUP

8.1 Enable multi-tenancy

bench config dns_multitenant on
bench setup add-domain [subdomain.yourdomain.com] --site site1.local

8.2 Set up SSL

sudo snap install core
sudo snap refresh core
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
sudo certbot --nginx

Now you have a fully working ERPNext installation using a virtual environment!


How to Install ERPNext v15 on Ubuntu 22.04
Hamed Mohammadi September 21, 2024
Share this post
Archive

Please visit our blog at:

https://zehabsd.com/blog

A platform for Flash Stories:

https://readflashy.com

A platform for Persian Literature Lovers:

https://sarayesokhan.com

Sign in to leave a comment