install ERPNext software on Debian 9

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

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:











Comments

Popular posts from this blog

Calculate Child Table Column and Sum it on Custom Field