Install ERPNext ERP System on Debian 11 / Debian 10

Posted on 13 views

Today we’ll discuss how you can install ERPNext ERP System on Debian 11 / Debian 10 Linux system. ERPNext is an open source ERP system written in Frappe framework . ERPNext ERP system provide outstanding features fit for both small and medium enterprises. Some of its key features are:

  • Inventory Management
  • Accounting Management
  • Purchase Management
  • Manufacturing Management
  • Customer Relationship Management system
  • Sales Management
  • Project Management
  • Huma Resource Management System and more.

ERPNext Setup Pre-requisites:

  • Updated Debian 11 / Debian 10 Linux
  • A user with sudo privileges
  • MariaDB Database Server
  • Nodejs, Nginx, yarn, redis, wkhtmltopdf

For Ubuntu, use: Install ERPNext ERP on Ubuntu 22.04 (Jammy Jellyfish)

Install ERPNext in Debian 11 / Debian 10

Let’s start ERPNext installation by making sure our system is updated:

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:

# Debian 11
sudo apt -y install git vim libffi-dev python3-pip python3-distutils python3-dev libssl-dev wkhtmltopdf

# Debian 10
sudo apt -y install git vim libffi-dev python-pip python-distutils python-dev libssl-dev wkhtmltopdf

Step 2: Install Redis and Node.js

Nodejs is required for running ERPNext on Debian 10 (Buster).

sudo apt -y install nodejs npm 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 vim nano

For installation of MariaDB server on Debian, run the commands below

sudo apt install mariadb-server mariadb-client

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

$ sudo vim /etc/mysql/my.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

Log in and Create Mysql Database

$ sudo mysql -u root -p

Create a database and grant the user all permissions to manage the DB.

CREATE USER [email protected] IDENTIFIED BY 'password123';
CREATE DATABASE erpnext;
GRANT ALL ON erpnext.* TO 'erpnext'@'localhost' with grant option;
FLUSH PRIVILEGES;
QUIT;

Step 4: Install Bench and ERPNext

A bench is a tool used to install and manage ERPNext on your Debian 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
$ vim ~/.bashrc
PATH=$PATH:~/.local/bin/
$ 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:

cd /srv/bench

Clone Bench code from github using git

$ git clone https://github.com/frappe/bench bench-repo
Cloning into 'bench-repo'...
remote: Counting objects: 5832, done.
remote: Compressing objects: 100% (43/43), done.
remote: Total 5832 (delta 20), reused 20 (delta 6), pack-reused 5783
Receiving objects: 100% (5832/5832), 29.61 MiB | 17.62 MiB/s, done.
Resolving deltas: 100% (3720/3720), done.

Now install bench using pip command:

# Debian 11
pip3 install -e bench-repo

#Debian 10
pip install -e bench-repo

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

cd /srv/bench
bench init erpnext
cd erpnext

A sample output is:

...
Done in 71.43s.
INFO:bench.utils:bench build
yarn run v1.21.1
$ FRAPPE_ENV=production node rollup/build.js
Production mode
✔ Built js/moment-bundle.min.js
✔ Built js/libs.min.js

Building frappe assets...

✔ Built js/checkout.min.js
✔ Built js/dialog.min.js
✔ Built js/modules.min.js
✔ Built js/social.min.js
✔ Built js/web_form.min.js
✔ Built js/list.min.js
✔ Built js/chat.js
✔ Built css/frappe-rtl.css
✔ Built css/printview.css
✔ Built css/module.min.css
✔ Built css/form.min.css
✔ Built css/list.min.css
✔ Built css/report.min.css
✔ Built frappe/css/email.css
✔ Built js/desk.min.js
✔ Built js/barcode_scanner.min.js
✔ Built css/frappe-chat-web.css
✔ Built css/web_form.css
✔ Built css/desk.min.css
✔ Built js/frappe-recorder.min.js
✔ Built css/frappe-web-b4.css
✔ Built js/frappe-web.min.js
✔ Built js/bootstrap-4-web.min.js
✔ Built js/control.min.js
✔ Built js/form.min.js
✔ Built js/data_import_tools.min.js
✔ Built js/report.min.js
✨  Done in 90.204s
Done in 91.96s.
INFO:bench.utils:setting up backups
no crontab for erpnext
INFO:bench.utils:setting up auto update
no crontab for erpnext
Bench erpnext initialized

Create a new Frappe site.

$ cd /srv/bench/erpnext
$ bench new-site erp.computingpost.com 
MySQL root password: 

Installing frappe...
Updating DocTypes for frappe        : [========================================]
Updating country info               : [========================================]
Set Administrator password: 
Re-enter Administrator password: 
*** 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 before you proceed.

Step 5: Starting ERPNext application and access UI

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

$ bench start

When the program is running, you should get:

12:49:02 redis_queue.1    | 30491:M 18 Jul 12:49:02.630 * Ready to accept connections
12:49:03 socketio.1       | listening on *: 9000
12:49:08 web.1            |  * Running on http://0.0.0.0:8000/ (Press CTRL+C to quit)
12:49:09 web.1            |  * Restarting with inotify reloader
12:49:09 watch.1          | yarn run v1.7.0
12:49:09 watch.1          | $ node rollup/watch.js
12:49:09 web.1            |  * Debugger is active!
12:49:09 web.1            |  * Debugger PIN: 849-623-753
12:49:10 watch.1          | 
12:49:10 watch.1          | Rollup Watcher Started
12:49:10 watch.1          | 

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.

This is not recommended way to run ERPNext in production. We’ll instead install supervisor and configure Nginx:

Step 6: Configure Nginx and Supervisord

Install supervisor:

sudo apt 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.computingpost.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.

Open your application domain configured to login- //erp.computingpost.com

erpnext-login-1024x619

You should get a page to login. Use the username Administrator and the password you provided during setup.

erpnext-ubuntu-18.04-01

Select the language of your choice and click “Next“. Next select country, it will fill currency automatically.

erpnext-ubuntu-18.04-02

erpnext-ubuntu-18.04-03

Add the first user with email and password and click “Complete Setup” button.

When done, you should get to ERPNext web dashboard.

erpnext-ubuntu-18.04-04

 

coffee

Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.