Saturday, December 28, 2024
Google search engine
HomeGuest BlogsInstall ERPNext ERP System on Debian 11 / Debian 10

Install ERPNext ERP System on Debian 11 / Debian 10

.tdi_3.td-a-rec{text-align:center}.tdi_3 .td-element-style{z-index:-1}.tdi_3.td-a-rec-img{text-align:left}.tdi_3.td-a-rec-img img{margin:0 auto 0 0}@media(max-width:767px){.tdi_3.td-a-rec-img{text-align:center}}

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:

  • Python 3.10+ (v14)
  • Node.js 16
  • Redis 6: (caching and realtime updates)
  • MariaDB 10.6.6+ / Postgres v12 to v14: (Database backend)
  • yarn 1.12+: (js dependency manager)
  • pip 20+: (py dependency manager)
  • wkhtmltopdf: (version 0.12.5 with patched qt) (for pdf generation)
  • cron: (bench’s scheduled jobs: automated certificate renewal, scheduled backups)
  • Nginx: (proxying multitenant sites in production)

Install ERPNext in Debian 11 / Debian 10

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

.tdi_2.td-a-rec{text-align:center}.tdi_2 .td-element-style{z-index:-1}.tdi_2.td-a-rec-img{text-align:left}.tdi_2.td-a-rec-img img{margin:0 auto 0 0}@media(max-width:767px){.tdi_2.td-a-rec-img{text-align:center}}

sudo apt update && sudo apt -y upgrade

It is recommended to reboot your system whenever you do upgrade:

[ -e /var/run/reboot-required ] && 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:

sudo apt -y install git vim libffi-dev python3-pip python3-venv python3-distutils python3-dev libssl-dev wkhtmltopdf xvfb libfontconfig

From ERPNext 14, Python 3.10+ is required. Install you can install it using the following guide:

But for simplicity we shall perform installation of ERPNext 13 instead.

Step 2: Install Redis and Node.js

Install Node.js

curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt install -y nodejs gcc g++ make

Install yarn

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 update && sudo apt install yarn -y

Install redis server

sudo apt -y install redis-server

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

curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version=10.8
sudo apt install mariadb-server mariadb-client -y

Set database password for root user

sudo mariadb-secure-installation

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

sudo tee  /etc/mysql/mariadb.conf.d/erpnext-server.cnf<<EOF
[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
EOF

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

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

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

Comment out other configurations in default server file.

sudo sed -i '/character-set-server/s/^/#/g' /etc/mysql/mariadb.conf.d/50-server.cnf
sudo sed -i '/collation-server/s/^/#/g' /etc/mysql/mariadb.conf.d/50-server.cnf

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
export 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:erpnext /srv/bench

Next switch to erpnext user and install the application:

cd /srv/bench

Upgrade pip3:

pip3 install --upgrade pip

Now install bench using pip command:

pip3 install frappe-bench --user

Validate installation:

$ bench --version
5.16.2

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

cd /srv/bench

To install specific version specify its branch. E.g for version 13:

bench init --frappe-branch version-13 frappe-bench

A sample output is:

...
Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade caniuse-lite browserslist`
✔ Built css/report.min.css
✔ Built css-rtl/report.min.css
✔ Built js/report.min.js
✔ Built js/data_import_tools.min.js
✔ Built css/web_form.css
✔ Built css-rtl/web_form.css
✔ Built js/control.min.js
✔ Built css/printview.css
✔ Built js/desk.min.js
✔ Built css/email.css
✔ Built css/login.css
✔ Built css-rtl/frappe-web-b4.css
✔ Built css/frappe-web-b4.css
✔ Built css/desk.min.css
✔ Built css-rtl/email.css
✔ Built css-rtl/login.css
✔ Built css-rtl/printview.css
✔ Built css-rtl/desk.min.css
✔ Built js/form.min.js
✨  Done in 73.308s
Done in 74.79s.
SUCCESS: Bench frappe-bench initialized

Create a new Frappe site. Replace erp.geeksforgeeks.org with your ERPNext website FQDN.

$ cd /srv/bench/frappe-bench/
$ SITE=erp.geeksforgeeks.org 
$ bench new-site $SITE
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 before you proceed.

Get erpnext app and install it.

bench get-app --branch version-13 erpnext
bench --site $SITE install-app erpnext

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:

$ bench --site $SITE  enable-scheduler
$ bench --site $SITE  set-maintenance-mode off
$ 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.geeksforgeeks.org 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. You can confirm nginx service status.

systemctl status nginx

Open your application domain configured to login- //erp.geeksforgeeks.org

erpnext login

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

To restrart ERPnext service use:

sudo supervisorctl restart all

You can install other applications in your site using bench command line tool.

bench get-app hrms
bench --site $SITE install-app hrms

Similar guides:

.tdi_4.td-a-rec{text-align:center}.tdi_4 .td-element-style{z-index:-1}.tdi_4.td-a-rec-img{text-align:left}.tdi_4.td-a-rec-img img{margin:0 auto 0 0}@media(max-width:767px){.tdi_4.td-a-rec-img{text-align:center}}

RELATED ARTICLES

Most Popular

Recent Comments