How to install ERPNext on Debian 9

ERPNext is a free and open source ERP software written in Python on top of the Frappe framework and includes Accounting, Inventory, Manufacturing, CRM, Sales, Purchase, Project Management, HRMS and more. ERPNext is a simple, powerful and easy to use ERP system. It comes with beautiful web interface that can be used to manage the day to day tasks from a central location.

In this tutorial, we will learn how to install ERPNext software on Debian 9 server.

Prerequisites

  • A server running Debian 9.
  • A non-root user with sudo privileges.

Getting Started

Before starting, it is recommended to update your package repository to the latest version. You can do this by running the following command:

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

Next, restart the system to apply all the changes.

Install Dependencies

ERPNext requires Python version 2.7 in order to work properly. You can install Python and other required packages by running the following command:

sudo apt-get install python-minimal git build-essential python-setuptools python-dev libffi-dev libssl-dev -y

You will also need to install Python’s pip tool to install Python dependencies. You can do this by running the following command:

wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py

Next, install ansible using the pip command:

sudo pip install ansible

Install Node.js, Redis and Nginx

By default, the latest version of the Node.js is not available in Debian 9. So you will need to add the Nodesource repository for Node.js 8.x. You can do this by running the following command:

sudo curl –silent –location https://deb.nodesource.com/setup_8.x | sudo bash –

Next, install Node.js, Nginx and Redis by running the following command:

sudo apt-get install nodejs redis-server nginx -y

Once all the packages are installed, start Nginx and Redis service and enable them to start on boot with the following command:

sudo systemctl start nginx
sudo systemctl enable nginx
sudo systemctl start redis-server
sudo systemctl enable redis-server

Install and Configure MariaDB

By default, the latest version of the MariaDB is not available in Debian 9 repository. So you will need to add MariaDB repository for that.

First, download and add signing key to your system with the following command:

sudo apt-get install software-properties-common dirmngr
sudo apt-key adv –recv-keys –keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8

Next, add MariaDB repository using the following command:

sudo add-apt-repository ‘deb [arch=amd64,i386,ppc64el] http://ftp.utexas.edu/mariadb/repo/10.2/debian stretch main’

Finally, install MariaDB server with the following command:

sudo apt-get update -y
sudo apt-get install mariadb-server libmysqlclient-dev -y

Next, you will need to add the Barracuda storage engine to the MariaDB configuration file for the creation of ERPNext databases. You can do this by editing my.cnf file:

sudo nano /etc/mysql/my.cnf

add the following lines:

[mysqld]

innodb-file-format=barracuda
innodb-file-per-table=1
innodb-large-prefix=1
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci

[mysql]

default-character-set = utf8mb4

Save and close the file when you are finished, then start MariaDB service and enable it to start on boot with the following command:

sudo systemctl restart mysql
sudo systemctl enable mysql

Next, secure MariaDB by running the mysql_secure_installation script:

sudo mysql_secure_installation

This script will set root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB as shown below:

Set root password? [Y/n] y
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y

Install PDF Converter

You will also need to install wkhtmltopdf to converts HTML into PDF using the QT Webkit rendering engine. First, install required dependencies using the following command:

sudo apt-get install libxext6 xfonts-75dpi xfonts-base libxrender1 -y

Next, download the latest version of wkhtmltopdf using the following command:

wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz

Next, extract the downloaded file to the /opt directory:

sudo tar -xvf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz -C /opt

Next, create a softlink for wkhtmltopdf using the following command:

sudo ln -s /opt/wkhtmltox/bin/wkhtmltopdf /usr/bin/wkhtmltopdf
sudo ln -s /opt/wkhtmltox/bin/wkhtmltopdf /usr/bin/wkhtmltopdf

Install Bench

Next, you will need to install Bench to install and manage the ERPNext application to your system. Bench is also used to create and manage Nginx and supervisor configurations.

Before installing Bench, you will need to add user for Bench.

First, create a Bench user with the following command:

sudo adduser bench

Next, provide sudo permissions to the bench user.

sudo usermod -aG sudo bench

Next, login with Bench user and clone the Bench repository with the following command:

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

Finally, install Bench using the pip command:

sudo pip install -e bench-repo

Install ERPNext

Next, initialize a bench directory with frappe framework installed.

bench init erpnext

Next, change the directory to the erpnext and create a new Frappe site with the following command:

cd erpnext
bench new-site test.example.com

The above command will ask to provide the MySQL root password and ask you to set a new password for the administrator account. The administrator password will need to log into the administrator dashboard later.

Next, download ERPNext installation files from Git repository with the following command:

bench get-app erpnext https://github.com/frappe/erpnext

Next, Install ERPNext on your newly created site.

bench –site test.example.com install-app erpnext

Finally, start the Bench application with the following command:

bench start

Once the application started successfully, you should see the following output:

13:40:10 system | redis_socketio.1 started (pid=2618)
13:40:10 system | worker_long.1 started (pid=2625)
13:40:10 system | watch.1 started (pid=2619)
13:40:10 system | redis_queue.1 started (pid=2626)
13:40:10 redis_socketio.1 | 2630:M 24 Feb 13:40:10.939 * Increased maximum number of open files to 10032 (it was originally set to 1024).
13:40:10 system | web.1 started (pid=2629)
13:40:11 system | schedule.1 started (pid=2634)
13:40:10 redis_socketio.1 | _._ 
13:40:10 redis_socketio.1 | _.-``__ ''-._ 
13:40:10 redis_socketio.1 | _.-`` `. `_. ''-._ Redis 3.0.6 (00000000/0) 64 bit
13:40:10 redis_socketio.1 | .-`` .-```. ```\/ _.,_ ''-._ 
13:40:10 redis_socketio.1 | ( ' , .-` | `, ) Running in standalone mode
13:40:10 redis_socketio.1 | |`-._`-...-` __...-.``-._|'` _.-'| Port: 12000
13:40:10 redis_socketio.1 | | `-._ `._ / _.-' | PID: 2630
13:40:10 redis_socketio.1 | `-._ `-._ `-./ _.-' _.-' 
13:40:10 redis_socketio.1 | |`-._`-._ `-.__.-' _.-'_.-'| 
13:40:10 redis_socketio.1 | | `-._`-._ _.-'_.-' | http://redis.io 
13:40:10 redis_socketio.1 | `-._ `-._`-.__.-'_.-' _.-' 
13:40:10 redis_socketio.1 | |`-._`-._ `-.__.-' _.-'_.-'| 
13:40:10 redis_socketio.1 | | `-._`-._ _.-'_.-' | 
13:40:10 redis_socketio.1 | `-._ `-._`-.__.-'_.-' _.-' 
13:40:10 redis_socketio.1 | `-._ `-.__.-' _.-' 
13:40:10 redis_socketio.1 | `-._ _.-' 
13:40:10 redis_socketio.1 | `-.__.-' 
13:40:10 redis_socketio.1 | 
13:40:11 system | worker_default.1 started (pid=2639)
13:40:10 redis_socketio.1 | 2630:M 24 Feb 13:40:10.973 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
13:40:10 redis_socketio.1 | 2630:M 24 Feb 13:40:10.974 # Server started, Redis version 3.0.6
13:40:10 redis_socketio.1 | 2630:M 24 Feb 13:40:10.974 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
13:40:10 redis_socketio.1 | 2630:M 24 Feb 13:40:10.974 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
13:40:10 redis_queue.1 | 2635:M 24 Feb 13:40:10.976 * Increased maximum number of open files to 10032 (it was originally set to 1024).
13:40:10 redis_queue.1 | _._ 
13:40:10 redis_queue.1 | _.-``__ ''-._ 
13:40:10 redis_queue.1 | _.-`` `. `_. ''-._ Redis 3.0.6 (00000000/0) 64 bit
13:40:10 redis_queue.1 | .-`` .-```. ```\/ _.,_ ''-._ 
13:40:10 redis_queue.1 | ( ' , .-` | `, ) Running in standalone mode
13:40:10 redis_queue.1 | |`-._`-...-` __...-.``-._|'` _.-'| Port: 11000
13:40:10 redis_queue.1 | | `-._ `._ / _.-' | PID: 2635
13:40:10 redis_queue.1 | `-._ `-._ `-./ _.-' _.-' 
13:40:10 redis_queue.1 | |`-._`-._ `-.__.-' _.-'_.-'| 
13:40:10 redis_queue.1 | | `-._`-._ _.-'_.-' | http://redis.io 
13:40:10 redis_queue.1 | `-._ `-._`-.__.-'_.-' _.-' 
13:40:10 redis_queue.1 | |`-._`-._ `-.__.-' _.-'_.-'| 
13:40:10 redis_queue.1 | | `-._`-._ _.-'_.-' | 
13:40:10 redis_queue.1 | `-._ `-._`-.__.-'_.-' _.-' 
13:40:10 redis_queue.1 | `-._ `-.__.-' _.-' 
13:40:10 redis_queue.1 | `-._ _.-' 
13:40:10 redis_queue.1 | `-.__.-' 
13:40:10 redis_queue.1 | 
13:40:10 redis_queue.1 | 2635:M 24 Feb 13:40:10.998 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
13:40:10 redis_queue.1 | 2635:M 24 Feb 13:40:10.999 # Server started, Redis version 3.0.6
13:40:11 redis_queue.1 | 2635:M 24 Feb 13:40:11.000 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
13:40:11 redis_socketio.1 | 2630:M 24 Feb 13:40:11.000 * The server is now ready to accept connections on port 12000
13:40:11 system | socketio.1 started (pid=2637)
13:40:11 redis_queue.1 | 2635:M 24 Feb 13:40:11.029 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
13:40:11 redis_queue.1 | 2635:M 24 Feb 13:40:11.029 * The server is now ready to accept connections on port 11000
13:40:11 system | redis_cache.1 started (pid=2652)
13:40:11 system | worker_short.1 started (pid=2651)
13:40:11 redis_cache.1 | 2660:M 24 Feb 13:40:11.100 * Increased maximum number of open files to 10032 (it was originally set to 1024).
13:40:11 redis_cache.1 | _._ 
13:40:11 redis_cache.1 | _.-``__ ''-._ 
13:40:11 redis_cache.1 | _.-`` `. `_. ''-._ Redis 3.0.6 (00000000/0) 64 bit
13:40:11 redis_cache.1 | .-`` .-```. ```\/ _.,_ ''-._ 
13:40:11 redis_cache.1 | ( ' , .-` | `, ) Running in standalone mode
13:40:11 redis_cache.1 | |`-._`-...-` __...-.``-._|'` _.-'| Port: 13000
13:40:11 redis_cache.1 | | `-._ `._ / _.-' | PID: 2660
13:40:11 redis_cache.1 | `-._ `-._ `-./ _.-' _.-' 
13:40:11 redis_cache.1 | |`-._`-._ `-.__.-' _.-'_.-'| 
13:40:11 redis_cache.1 | | `-._`-._ _.-'_.-' | http://redis.io 
13:40:11 redis_cache.1 | `-._ `-._`-.__.-'_.-' _.-' 
13:40:11 redis_cache.1 | |`-._`-._ `-.__.-' _.-'_.-'| 
13:40:11 redis_cache.1 | | `-._`-._ _.-'_.-' | 
13:40:11 redis_cache.1 | `-._ `-._`-.__.-'_.-' _.-' 
13:40:11 redis_cache.1 | `-._ `-.__.-' _.-' 
13:40:11 redis_cache.1 | `-._ _.-' 
13:40:11 redis_cache.1 | `-.__.-' 
13:40:11 redis_cache.1 | 
13:40:11 redis_cache.1 | 2660:M 24 Feb 13:40:11.115 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
13:40:11 redis_cache.1 | 2660:M 24 Feb 13:40:11.115 # Server started, Redis version 3.0.6
13:40:11 redis_cache.1 | 2660:M 24 Feb 13:40:11.115 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
13:40:11 redis_cache.1 | 2660:M 24 Feb 13:40:11.116 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
13:40:11 redis_cache.1 | 2660:M 24 Feb 13:40:11.116 * The server is now ready to accept connections on port 13000
13:40:16 socketio.1 | listening on *: 9000
13:40:34 worker_long.1 | 13:40:34 RQ worker u'rq:worker:Node1.2632.long' started, version 0.10.0
13:40:34 worker_long.1 | 13:40:34 *** Listening on long...
13:40:34 worker_long.1 | 13:40:34 Cleaning registries for queue: long
13:40:34 worker_default.1 | 13:40:34 RQ worker u'rq:worker:Node1.2646.default' started, version 0.10.0
13:40:34 worker_default.1 | 13:40:34 *** Listening on default...
13:40:34 worker_default.1 | 13:40:34 Cleaning registries for queue: default
13:40:34 worker_short.1 | 13:40:34 RQ worker u'rq:worker:Node1.2661.short' started, version 0.10.0
13:40:34 worker_short.1 | 13:40:34 *** Listening on short...
13:40:34 worker_short.1 | 13:40:34 Cleaning registries for queue: short
13:40:34 web.1 | * Running on http://0.0.0.0:8000/ (Press CTRL+C to quit)


Access ERPNext Web Interface

ERPNext is now installed and runs on port 8000. It’s time to Access ERPNext Web Interface.

Open your web browser and type the URL http://test.exaple.com:8000, you will be redirected to the following page:

Access ERPNext Web Interface

Here, provide your Administrator account credential and click on the Sign in button, you should see the following page:

Administrator account credential

Here, choose English language and click on the Next button, you should see the following page:

choose English language

Here, choose your Country, Time Zone and Currency, then click on the Next button, you should see the following page:

choose your Country, Time Zone and Currency

Here, provide your Name, Email and Password, then click on the Next button, you should see the following page:

provide your Name, Email and Password

Here, select your Domain as you wish, then click on the Next button, you should see the following page:

Set domain name

Here, provide your Company name and abbreviation, then click on the Next button, you should see the following page:

provide your Company name and abbreviation

Here, provide your Organization details and click on the Complete Setup button, you should see the following page:

provide your Organization details

Setup complete

Here, set a target you would like to achieve for your Company, then click on the Create button, you should see the following page:

Set a target

Here, click on the Next button to continue, you should see the following page:

Add customers

Here, add customers you would like to add, then click on the Create button, you should see the following page:

Customers added

Here, click on the Next button to continue, you should see the following page:

Add suppliers

Here, add your suppliers you would like to add, then click on the Create button, you should see the following page:

Add a new supplier

Here, click on the Next button to continue, you should see the following page:

Add products

Here, add your products and services you would like to buy or sell, then click on the Create button, you should see the following page:

Add a new product

Here, click on the Next button to continue, you should see the following page:

Add users

Here, add users to your organization, then click on the Create button, you should see the ERPNext dashboard following page:

ERPNext Dashboard

Conclusion

Congratulations! you have successfully installed and configured ERPNext on Debian 9 server. You can now easily use the application to manage your company. For more information, please refer to the official ERPNext documentation page at  Doc.

Share this page:

نوشته های مشابه