ERPNext Installation on Ubuntu 20.04

I am using Proxmox at my home lab. I have configured Ubuntu 20.04 as Linux Container and allowed the permission to the ssh for commands through putty

to enable ssh for remote login using the following command

sudo nano /etc/ssh/sshd_config

Now look for the line

PermitRootLogin without-password

Replace the above line with (make sure hash # is removed)

PermitRootLogin yes

Here is a step by step guide to install ERPNext on Ubuntu 20.04

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

Start the installation process by ensuring all Python build packages required to build and setup ERPNext are installed:

### Ubuntu 20.04 ###
sudo apt update
sudo apt -y install vim libffi-dev python3-pip python3-dev  python3-testresources libssl-dev wkhtmltopdf

Step 2: Install Curl, Redis and Node.js

To install Redis and Node.js on Ubuntu 20.04/18.04, run the commands:

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
sudo curl --silent --location https://deb.nodesource.com/setup_12.x | sudo bash -
sudo apt -y install gcc g++ make nodejs redis-server
sudo npm install -g yarn

Step 3: Install Nginx web server and MariaDB Database server

Next step is to Nginx and MariaDB for serving ERPNext and storing database data respectively.

Install Nginx using:

sudo apt -y install nginx

For installation of MariaDB server on Ubuntu:

sudo apt install mariadb-server

Change authentication plugin.

$ sudo mysql -u root
USE mysql;
UPDATE user SET plugin='mysql_native_password' WHERE User='root';
FLUSH PRIVILEGES;
EXIT;

Ensure you have the following settings for mysqld and mysql client as provided:

$ sudo vim /etc/mysql/mariadb.conf.d/50-server.cnf
[mysqld]

character-set-client-handshake = FALSE

character-set-server = utf8mb4

collation_server = utf8mb4_unicode_ci

[mysql]

default-character-set = utf8mb4

After the installation of MariaDB database server, you should create a database for erpnext user.

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

Update your PATH.

sudo su - erpnext

tee -a ~/.bashrc<<EOF
PATH=\$PATH:~/.local/bin/
EOF

source ~/.bashrc

Create a directory for ERPNext setup and give erpnext user read and write permissions to the directory:

sudo mkdir /srv/bench
sudo chown -R erpnext /srv/bench

Next switch to erpnext user and install the application:

sudo su - erpnext
cd /srv/bench

Clone Bench code from github using git

$ git clone https://github.com/frappe/bench bench-repo

Now install bench using pip command:

sudo pip3 install -e bench-repo

The next step is to initialize the bench directory with frappe framework installed:

cd /srv/bench
bench init erpnext

Create a new Frappe site.

$ cd erpnext
$ bench new-site  erp.syncbricks.com 
MySQL root password: 

Installing frappe...
Updating DocTypes for frappe        : [========================================]
Updating country info               : [========================================]
Set Administrator password: <input-admin-pass>
Re-enter Administrator password: <confirm-admin-pass>
*** Scheduler is disabled ***

The above command will ask you to provide the MySQL root password and set a new password for the administrator account for the web interface. Wait for the new Frappe site to be created, then

Step 5: Starting ERPNext application and access UI

Once the application is deployed, you can start it using the command:

$ bench start

From the output, you can confirm the service is running on http://0.0.0.0:8000/. To access the web interface, open the server IP address and port http://ip-address:8000.

Step 6: Configure Nginx and Supervisord

Install supervisor:

sudo apt -y install supervisor

Run production configuration script:

sudo bench setup production erpnext
supervisor.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
Port configuration list:

Site erp.syncbricks.com assigned port: 80
nginx.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
INFO:bench.utils:sudo /usr/bin/supervisorctl reread
No config updates to processes
INFO:bench.utils:sudo /usr/bin/supervisorctl update
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
INFO:bench.utils:sudo systemctl reload nginx

Generated Nginx file is placed under: /etc/nginx/conf.d/erpnext.conf and supervisor config file is /etc/supervisor/conf.d/erpnext.conf.

About Amjid

Check Also

Pi-hole DNS Server Installation Guide on Raspian and Ubuntu

Pi-Hole is a Network Wide protection system that helps to block the ads and improves …

Leave a Reply

Your email address will not be published.