How to Easy Install ERPNext 14 on Ubuntu 22.04 LTS on Digitalocean Droplet
Published: 2023-04-17 13:48:20

---
title: How to Easy Install ERPNext 14 on Ubuntu 22.04 LTS on Digitalocean Droplet
published: true
date: 2023-04-07 06:18:55 UTC
tags: 
canonical_url: https://blog.chetanmittaldev.com/how-to-easy-install-erpnext-14-on-ubuntu-2204-lts-on-digitalocean-droplet
---

ERPnext is a 100% open source and FREE [Enterprise Resource Planning](https://www.investopedia.com/terms/e/erp.asp) software developed and maintained by a [FOSS](https://en.wikipedia.org/wiki/Free_and_open-source_software)-promoting company, [Frappe Technologies Pvt. Ltd.](https://frappe.io/about), based out of India's financial capital [Mumbai](https://en.wikipedia.org/wiki/Mumbai).

ERPNext is the best among FREE ERPs available in 2023 such as Dolibarr, Odoo, etc. In 2018, ERPNext was rated among the top 5 user-friendly ERP systems by Gartner, surpassing Microsoft, SAP, Bexio, and several other ERP systems.

![chetanmittaldev-install-erpnext14-ubuntu2204-digitalocean-1](https://cdn.hashnode.com/res/hashnode/image/upload/v1680846407344/08f9e770-910e-417d-a923-c103d0b1e301.png)

[ERPNext](https://erpnext.com/version-14) is available as a self-hosted software for your small to medium business to install on your own servers helping you to maintain your data privacy without paying a dime for the licensing fee (except the server costs).

However, it is not easy for non-technical users to get the hang of it.

My ERPNext installation guide below is an easy-to-follow set of instructions helping you to easily install ERPNext version 14 on a 4GB droplet hosting Ubuntu 22.04 LTS.

Let's get started:-

## **Create a new droplet on Digitalocean with Ubuntu 22.04**

[Signup](https://m.do.co/c/5007c53b92d9) for a new account or log in to your already existing account on [Digitalocean](https://m.do.co/c/5007c53b92d9).

Once you are on the [_"projects"_](https://cloud.digitalocean.com/projects) page of your Digitalocean account, click on the green "Create" button on the top right and select "_droplet"_ from the dropdown. This will take you to the _"Create Droplets"_ page.

![chetanmittaldev-install-erpnext14-ubuntu2204-digitalocean-2](https://cdn.hashnode.com/res/hashnode/image/upload/v1680847386353/255b9f5d-a9f2-4b68-b9f8-acf34d6c3d9b.png)

On the _"Create Droplet"_ page you can configure your server by following the instructions on this page such as:-

- **Your server's data center:** I usually pick Bengaluru or Singapore because those are the nearest to my location.

- **An operating system image for your server:** I usually prefer the latest Ubuntu LTS. Currently, the LTS version of Ubuntu is 22.04.

- **The CPU size for your server:** I usually pick _Basic_ and _Regular_ with 4GB RAM for a new ERPNext installation. _I would recommend a minimum RAM for ERPNext of 2GB with 4GB SWAP._

![chetanmittaldev-install-erpnext14-ubuntu2204-digitalocean-3](https://cdn.hashnode.com/res/hashnode/image/upload/v1680848303722/f08f1ed4-62eb-4841-b38b-a475ae4fbb8e.png)

After you have configured the server add your SSH key for easy access to your server from your PC.

If you are on Windows then you can use Putty to access your server else you can simply run `ssh root@-your-droplet-ip-address` on your Linux terminal or Mac Command.

Finally, hit the _"Create Droplet"_ button to create a new server for your ERPNext 14 installation.

![chetanmittaldev-install-erpnext14-ubuntu2204-digitalocean-4](https://cdn.hashnode.com/res/hashnode/image/upload/v1680849609431/4d1e82c1-ab40-48fe-9d13-85746b700935.png)

## **Install all the preliminary software required to install Frappe and ERPNext**

To install Frappe and ERPNext we need to install a few essential software such as `gcc`, `python`, `mariadb`, etc.

**Follow the instructions below:-**

Login to your server from your PC for easy access. As I use ArchLinux thus I just have to open a `Terminal` window and then just `ssh` into my server.

![chetanmittaldev-install-erpnext14-ubuntu2204-digitalocean-5](https://cdn.hashnode.com/res/hashnode/image/upload/v1680849725126/98df0b3e-ce91-4da5-a65c-87895d11895f.png)

Replace my server's IP address with your droplet's IP address. **_Note:-_** _I will ~~delete~~ my server post-publishing this article._

`$ssh root@-your-droplet-ip-address`

### **Add SWAP to your server**

Though 4GB RAM is enough for an ERPNext instance, however, just in case there might be a RAM-eating process so to keep our instance running it would be nice to have some SWAP.

I usually prefer a SWAP of 2x of your server RAM but you can add a 4GB swap too to save disk space.

**Follow the guide here to add swap:** [https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-22-04](https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-22-04).

Verify if you already have a SWAP:-

![chetanmittaldev-install-erpnext14-ubuntu2204-digitalocean-6](https://cdn.hashnode.com/res/hashnode/image/upload/v1680850388803/a952b039-775b-4451-a162-2676bc197932.png)

Create an 8GB SWAP:-

![chetanmittaldev-install-erpnext14-ubuntu2204-digitalocean-7](https://cdn.hashnode.com/res/hashnode/image/upload/v1680850611328/b159fba7-cadb-4f7e-a8ef-fec923c4f7ce.png)

Make your SWAP permanent so that when you restart your server then also you will have your SWAP.

![chetanmittaldev-install-erpnext14-ubuntu2204-digitalocean-8](https://cdn.hashnode.com/res/hashnode/image/upload/v1680850697197/e0aeeb8b-7dee-4092-a51e-70d8f5cdae4c.png)

Adjust or tune your SWAP settings `swappiness` and `vfs_cache_pressure`:-

![chetanmittaldev-install-erpnext14-ubuntu2204-digitalocean-9](https://cdn.hashnode.com/res/hashnode/image/upload/v1680851086916/5ad142a6-7d6f-4ccf-a6ef-68e3512728ba.png)

### **Update your server and install the _LOCALES_**

`$ sudo apt update`

`$ sudo apt upgrade`

After you have completely upgraded your Ubuntu 22.04 server, then you can install `LOCALES` which are required by ERPNext.

`$ sudo localectl set-keymap us && sudo localectl set-locale LANG=en_US.utf8`

**Note:-** If you get an error `Failed to set keymap: Keymap us is not installed.` then you can follow the instructions given at [https://www.claudiokuenzler.com/blog/1257/how-to-fix-missing-keymaps-debian-ubuntu-localectl-failed-read-list](https://www.claudiokuenzler.com/blog/1257/how-to-fix-missing-keymaps-debian-ubuntu-localectl-failed-read-list) to resolve this error and continue with installing ERPNext 14.

![chetanmittaldev-install-erpnext14-ubuntu2204-digitalocean-10](https://cdn.hashnode.com/res/hashnode/image/upload/v1680851821376/7390f0ab-5268-446f-a0b4-a6acfc7608f1.png)

`$ sudo nano /etc/environment` _(and copy-paste the following at the bottom of the file after_ `$PATH`_)_

####################  
LC\_ALL=en\_US.UTF-8  
LC\_CTYPE=en\_US.UTF-8  
LANG=en\_US.UTF-8

####################

![chetanmittaldev-install-erpnext14-ubuntu2204-digitalocean-11](https://cdn.hashnode.com/res/hashnode/image/upload/v1680851912792/824e5a2a-b41c-4274-b1e8-c5172a69b8c5.png)

Now, reboot your server for the locales and server updates.

`$ sudo reboot`

### **Install the NGINX HTTP server**

`$ sudo apt install nginx` _(and test by opening your-droplet-ip-address in a browser window)_

![chetanmittaldev-install-erpnext14-ubuntu2204-digitalocean-12](https://cdn.hashnode.com/res/hashnode/image/upload/v1680852551093/625f749c-934f-4407-9e66-716636850d4f.png)

The below section is optional, however, if you want to access your ERPNext instance using `HTTPS://DOMAIN_NAME` then you must follow these optional instructions.

**OPTIONAL**

Install `certbot` (ubuntu 20.04 doesnt support `certbot-auto` required by `erpnextfrappe-bench` thus we will use `snap` to install `certbot` `classic` to generate SSL certificates manually using lets-encrypt).

`$ sudo service nginx stop`

`$ sudo snap install --classic certbot`

Generate a lets-encrypt SSL certificate for your domain name(s) - the certificate will be saved under `-your-domain-name-folder-name-` at `/etc/letsencrypt/live`

`$ sudo certbot certonly --standalone` _(your domain name(s) will be asked here)_

`$ sudo service nginx start`

**OPTIONAL ENDS**

### **Install the MySQL database server**

`$ sudo apt install mariadb-server`

`$ sudo apt install python3-mysqldb libmysqlclient-dev`

`$ sudo mysql_secure_installation`

![chetanmittaldev-install-erpnext14-ubuntu2204-digitalocean-13](https://cdn.hashnode.com/res/hashnode/image/upload/v1680853582364/68fbd6a9-b6dd-48d5-a6a5-ec148a787c06.png)

`$ sudo systemctl stop mariadb`

`$ sudo nano /etc/mysql/mariadb.conf.d/mariadb.cnf` _(and copy-paste the following to save file)_

[https://gist.github.com/chetanmittaldev/28ea822b9815feac891d2c809f8d2598](https://gist.github.com/chetanmittaldev/28ea822b9815feac891d2c809f8d2598)

Restart the MySQL server:-

`$ sudo systemctl start mariadb`

`$ sudo systemctl enable mariadb`

### **Install the Ubuntu packages required for Python3, etc.**

`$ sudo DEBIAN_FRONTEND=noninteractive apt install -y curl build-essential python3-testresources python3-setuptools python3-dev libffi-dev python3-pip libcurl4 dnsmasq fontconfig git htop libcrypto++-dev libfreetype6-dev liblcms2-dev libwebp-dev libxext6 libxrender1 libxslt1-dev libxslt1.1 libffi-dev ntpdate postfix python3-dev python-tk screen vim xfonts-75dpi xfonts-base zlib1g-dev apt-transport-https libsasl2-dev libldap2-dev libcups2-dev pv libjpeg8-dev libtiff5-dev tcl8.6-dev tk8.6-dev libdate-manip-perl logwatch`

### **Add a system user 'frappe' to install ERPNext**

Add user `'frappe'` with password `'password'` by running the commands below in your terminal:-

`$ adduser frappe`

`$ usermod -aG sudo frappe`

`$ rsync --archive --chown=frappe:frappe ~/.ssh /home/frappe/`

### **Create your MySQL database**

Add a MySQL database `'frappe'` with user `'frappe'` and password `'password'` by running the commands below:-

`$ mysql`

`$ MariaDB [(none)]> CREATE DATABASE frappe;`

`$ MariaDB [(none)]> SHOW DATABASES;`

`$ MariaDB [(none)]> GRANT ALL PRIVILEGES ON . TO 'frappe'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;`

`$ MariaDB [(none)]> SELECT host, user, Super_priv FROM mysql.user;`

`$ MariaDB [(none)]> FLUSH PRIVILEGES;`

`$ MariaDB [(none)]> exit`

![chetanmittaldev-install-erpnext14-ubuntu2204-digitalocean-14](https://cdn.hashnode.com/res/hashnode/image/upload/v1680854640242/f6171948-01fa-4bfc-a846-f7507089fbe0.png)

### **SSH into your server using the 'frappe' user in a new console or terminal window**

`$ ssh frappe@-your-droplet-ip-address`

### **Install some python3-based packages such as setuptools, etc**

`$ sudo -H python3 -m pip install --upgrade setuptools cryptography psutil`

![chetanmittaldev-install-erpnext14-ubuntu2204-digitalocean-15](https://cdn.hashnode.com/res/hashnode/image/upload/v1680856335882/aa7d16ee-51f3-4412-8f58-0639d7d30618.png)

### **Install wkhtmltopdf**

install `wkhtmltopdf` as erpnext12 requires 0.12.5 version (i am not sure about erpnext13 or erpnext14 but installed just in case):-

`$ cd /tmp`

`$ wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb`

Now, `wkhtmltopdf` needs libssl1.1 package which is not available on Ubuntu 22.04 LTS thus we will add the packages repo for Ubuntu 20.04 and then install libssl1.1 from there:-

`$ echo "deb http://security.ubuntu.com/ubuntu focal-security main" | sudo tee /etc/apt/sources.list.d/focal-security.list`

`$ sudo apt-get update`

`$ sudo apt-get install libssl1.1`

`$ sudo dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.deb`

`$ sudo cp /usr/local/bin/wkhtmlto* /usr/bin/`

`$ cd ~`

`$ sudo chmod a+x /usr/bin/wk*`

`$ sudo rm /etc/apt/sources.list.d/focal-security.list`

### **Install the Redis Cache Server**

`$ sudo apt install git python-dev-is-python3 python3-dev redis-server`

`$ sudo apt-get install software-properties-common`

`$ sudo apt-get install xvfb libfontconfig wkhtmltopdf`

`$ sudo systemctl enable redis-server`

![chetanmittaldev-install-erpnext14-ubuntu2204-digitalocean-16](https://cdn.hashnode.com/res/hashnode/image/upload/v1680861899950/59c41c3d-5a67-474c-bb89-b45f56d44927.png)

### **Install nodejs by using NVM**

`$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash`

`$ sudo reboot` (required to run nvm command)

**SSH into** `'frappe'` **user again**

`$ nvm install --lts` _(install the LTS version of NodeJS; currently, it is v18.15.0)_

`$ npm install -g yarn`

**Verify nodejs, npm, yarn installations:-**

`$ yarn --version`

`$ npm -v`

`$ node -v`

![chetanmittaldev-install-erpnext14-ubuntu2204-digitalocean-17](https://cdn.hashnode.com/res/hashnode/image/upload/v1680861739164/e582098d-5661-4c01-ad96-373d9209e9de.png)

**Lets summarize what we have accomplished so far. Up to this point, you have installed all the major components required by ERPNext 14, which include:-**

1. Nginx

2. Certbot

3. SSL Certificate Generate

4. Python3

5. MariaDB DB

6. Nodejs, NPM

7. The Yarn package manager

8. A Redis database cache

9. The wkhtmltopdf PDF documents generator

Whether you are installing the ERP system for development or for production, you are now ready for the next step, which is installing the Frappe full-stack framework and the actual ERPNext 14 web application.

## **Install the Frappe full-stack web framework and ERPNext web application**

SSH 'frappe' system user in a new console or terminal window:-

`$ ssh frappe@-your-droplet-ip-address`

### **Install bench (Installing Frappe Bench CLI)**

`$ cd ~`

`$ sudo chown frappe -R /home/frappe`

`$ sudo pip3 install frappe-bench`

`$ bench --version`

`$ sudo apt install python3.10-venv`

`$ bench init frappe-bench`

![chetanmittaldev-install-erpnext14-ubuntu2204-digitalocean-18](https://cdn.hashnode.com/res/hashnode/image/upload/v1680862513767/e050f9ea-0fdf-42dd-a777-3917f6291bec.png)

`$ cd frappe-bench`

`$ echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p`

`$ ./env/bin/pip install numpy && ./env/bin/pip install pandas`

### **Upgrade pip**

`$ /home/frappe/frappe-bench/env/bin/python -m pip install --upgrade pip`

### **Install bench apps**

`$ bench get-app erpnext`

### **Add a new site to the bench**

`$ bench new-site -your-domain-name-or-droplet-ip-address- --admin-password -your-admin-password- --mariadb-root-username frappe --mariadb-root-password 'password'`

![chetanmittaldev-install-erpnext14-ubuntu2204-digitalocean-19](https://cdn.hashnode.com/res/hashnode/image/upload/v1680863901597/038745fa-b59d-412d-abc3-da85838d418c.png)

### **Install bench app to bench site**

`$ bench --site -your-domain-name-or-droplet-ip-address- install-app erpnext`

![chetanmittaldev-install-erpnext14-ubuntu2204-digitalocean-20](https://cdn.hashnode.com/res/hashnode/image/upload/v1680864079189/5b132e8e-66b4-48b5-97eb-bd00bf8c27e6.png)

### **Test bench on port 8000**

`$ bench start`

Open a new browser window and open `-your-domain-name-or-droplet-ip-address-:8000` to test:-

![chetanmittaldev-install-erpnext14-ubuntu2204-digitalocean-21](https://cdn.hashnode.com/res/hashnode/image/upload/v1680864217343/f744b997-478e-4337-80b6-a9552586b7cc.png)

![chetanmittaldev-install-erpnext14-ubuntu2204-digitalocean-22](https://cdn.hashnode.com/res/hashnode/image/upload/v1680864357977/0d3f43ce-07c0-4cd9-9848-6050dba10c5d.png)

![chetanmittaldev-install-erpnext14-ubuntu2204-digitalocean-23](https://cdn.hashnode.com/res/hashnode/image/upload/v1680864412045/3d4b1826-2a7e-4754-8dfb-53944910a723.png)

## **Setup production server using NGINX for your ERPNext instance**

SSH your server using `'frappe'` user in a new console or terminal window:-

`$ ssh frappe@-your-droplet-ip-address`

`$ cd /home/frappe/frappe-bench`

`$ sudo bench setup production frappe --yes`

**Verify if the required services work on your server:-**

`$ sudo supervisorctl stop all`

`$ sudo supervisorctl start all`

`$ systemctl list-unit-files | grep 'fail2ban|nginx|supervisor'`

After confirming that everything is working as expected, you can test ERPNext 14 live on your server.

Open your favorite browser and navigate to -your-domain-name-or-droplet-ip-address-, or wherever you are hosting your ERPNext 14 application.

After a few seconds, you should see the ERPNext 14 login screen.

Use _Administrator_ for the username (email) and the _erpnext\_admin\_password_ you created previously for the password.

**The NGINX conf file is saved in the path below:-**

`$ sudo nano /etc/nginx/conf.d/frappe-bench.conf`

### **Add HTTPS**

`$ sudo -H bench setup add-domain -your-cname-domain-name-`

`$ sudo -H bench setup nginx`

`$ sudo service nginx reload`

**Turn on multi-tenancy for HTTPS to work:-**

`$ sudo -H bench config dns_multitenant on`

`$ sudo -H bench setup nginx`

`$ sudo service nginx reload`

**Add SSL certificate** (lets-encrypt) to bench site (install HTTPS on apex domain) - frappe-bench uses the same path /etc/letsencrypt/live to get SSL certificates:-

`$ sudo -H bench setup lets-encrypt -your-domain-name-or-droplet-ip-address- custom-domain -your-cname-domain-name-`

`$ sudo -H bench setup nginx`

`$ sudo service nginx reload {or $ sudo service nginx start}`

## **Start using ERPNext**

Open `-your-domain-name-or-droplet-ip-address-` in a browser window.

Known Issues

1. **WARN Cannot connect to redis\_cache to update assets\_json** during `bench init` then you can follow the instructions at [https://discuss.frappe.io/t/issue-w-redis-during-bench-init-step/87134](https://discuss.frappe.io/t/issue-w-redis-during-bench-init-step/87134).

2. Bench runs fine on port 8000, however, during production it doesn't run. This might be due to the redis-server not being run on port 11000. To fix this open file `sudo nano /etc/redis/redis.conf` and change the port to 11000. Do not forget to reload the redis-server again. Follow the instructions at [https://linuxhint.com/change-default-port-redis/](https://linuxhint.com/change-default-port-redis/).

## **Any issues then comment**

If you face any issues then please comment, and I will try to rectify them.