How to Install Erpnext on Debian 11
ERPNext is a free and open-source integrated Enterprise Resource Planning software developed by an Indian software company Frappe Technologies Pvt. Ltd. and is built on MariaDB database system using Frappe, a Python based server-side framework.
Prerequisites
- Debian 11 VPS with at least 4GB of RAM and 40GB Disk
- root access or a user with sudo privileges
- A qualified domain or subdomain name
Update the System
Before starting update all Ubuntu 22.04 packages installed on the server are up to date using below command,
apt update -y
apt upgrade -y
Create New User
Create a new Frappe Bench User for our ERPNext installation,
sudo adduser (New-Frappe-User)
usermod -aG sudo (New-Frappe-User)
su (New-Frappe-User)
cd /home/(New-Frappe-User)
Replace (New-Frappe-User) with the actual username
Install Dependencies
Install required packages using below command,
Install GIT
,
sudo apt-get install git
Install Python3.9
, as ERPNext version 14 requires Python 3.10+ version,
sudo apt-get install python3-dev python3.9-dev python3-setuptools python3-pip python3-distutils
Install virtual environment to manage software at one place,
sudo apt-get install python3.9-venv
Install Software Properties Common,
sudo apt-get install software-properties-common
Install MariaDB
,
sudo apt install mariadb-server mariadb-client
Install Redis Server
,
sudo apt-get install redis-server
Install Other Required Packages using below command,
sudo apt-get install xvfb libfontconfig wkhtmltopdf
sudo apt-get install libmariadb-dev-compat libmariadb-dev
Configure MYSQL Server
sudo mysql_secure_installation
Output:
Enter current password for root (enter for none): Press your [Enter] key, there is no password set by default
Switch to unix_socket authentication N
Set root password? [Y/n] Y
New password: Enter_Your_Password
Re-enter new password: Enter_Your_Password
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
Edit MYSQL default config file,
sudo nano /etc/mysql/my.cnf
Add the following to the file,
[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
[mysql]
default-character-set = utf8mb4
Restart the MYSQL Server using below command,
sudo service mysql restart
Install CURL, Node, NPM and Yarn
Install CURL
,
sudo apt install curl
Install Node
16.15.0,
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
source ~/.profile
nvm install 16.15.0
Output:
frappe@vps:~$ nvm install 16.15.0
Downloading and installing node v16.15.0...
Downloading https://nodejs.org/dist/v16.15.0/node-v16.15.0-linux-x64.tar.xz...
######################################################################################################################################################################################################## 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v16.15.0 (npm v8.5.5)
Creating default alias: default -> 16.15.0 (-> v16.15.0)
Install NPM
,
sudo apt-get install npm
Install Yarn
,
sudo npm install -g yarn
Install Frappe Bench
,
sudo pip3 install frappe-bench
Initialize Frappe Bench,
bench init --frappe-branch version-13 frappe-bench
Output:
frappe@vps:~$ bench init --frappe-branch version-13 frappe-bench
Setting Up Environment
$ python3 -m venv env
$ /home/frappe/frappe-bench/env/bin/python -m pip install --quiet --upgrade pip
$ /home/frappe/frappe-bench/env/bin/python -m pip install --quiet wheel
Getting frappe
$ git clone https://github.com/frappe/frappe.git --branch version-13 --depth 1 --origin upstream
Cloning into 'frappe'...
remote: Enumerating objects: 3014, done.
remote: Counting objects: 100% (3014/3014), done.
remote: Compressing objects: 100% (2713/2713), done.
remote: Total 3014 (delta 456), reused 1043 (delta 229), pack-reused 0
Receiving objects: 100% (3014/3014), 17.31 MiB | 14.48 MiB/s, done.
Resolving deltas: 100% (456/456), done.
Installing frappe
$ /home/frappe/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/frappe/frappe-bench/apps/frappe
$ yarn install
yarn install v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > bootstrap@4.5.0" has unmet peer dependency "popper.js@^1.16.0".
warning Workspaces can only be enabled in private projects.
[4/4] Building fresh packages...
$ yarn run snyk-protect
yarn run v1.22.19
$ snyk protect
⚠ WARNING: Snyk protect was removed at 31 March 2022.
Please use '@snyk/protect' package instead: https://updates.snyk.io/snyk-wizard-and-snyk-protect-removal-224137
Done in 0.71s.
Done in 47.19s.
Found existing apps updating states...
WARN: restart failed: Couldn't find supervisorctl in PATH
$ bench build
Assets for Release v13.56.5 don't exist
✔ Application Assets Linked
yarn run v1.22.19
$ 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/user_profile_controller.min.js
✔ Built js/web_form.min.js
✔ Built js/list.min.js
✔ Built js/bootstrap-4-web.min.js
✔ Built js/barcode_scanner.min.js
✔ Built js/frappe-recorder.min.js
✔ Built js/frappe-web.min.js
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
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 css/web_form.css
✔ Built css-rtl/web_form.css
✔ Built js/data_import_tools.min.js
✔ Built js/report.min.js
✔ Built js/control.min.js
✔ Built css/printview.css
✔ Built css/email.css
✔ Built css/login.css
✔ Built css/frappe-web-b4.css
✔ Built js/desk.min.js
✔ Built css-rtl/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 86.071s
Done in 88.66s.
SUCCESS: Bench frappe-bench initialized
Switch directory into the Frappe Bench directory,
cd frappe-bench
Change user directory permissions to set execution permission to the home directory,
chmod -R o+rx /home/[frappe-user]
Create a New Site,
bench new-site dev.domainhere.info
It'll prompt you to set the password for Administrator user, can set strong password
Output:
frappe@vps:~/frappe-bench$ bench new-site dev.domainhere.info
MySQL root password:
Installing frappe...
Updating DocTypes for frappe : [========================================] 100%
Updating country info : [========================================] 100%
Set Administrator password:
Re-enter Administrator password:
Replace dev.domainhere.info with actual domain name
Install ERPNext and other Apps
Download all the apps using below commands,
Download payments
app using below command,
bench get-app payments
Download ERPNext
app using below command,
bench get-app --branch version-13 erpnext
Install all the apps on our site
bench --site dev.domainhere.info install-app erpnext
Start the bench
using below command,
bench start
Note: This instances which are running on develop mode, this will not get started when you restart your server. You will need to run the bench start command every time the server restarts.
In the below steps, we will learn how to deploy the production mode.
Setting ERPNext for Production Usage
Enable Scheduler
bench --site dev.domainhere.info enable-scheduler
Output:
frappe@vps:~/frappe-bench$ bench --site dev.domainhere.info enable-scheduler
Enabled for erp.domainhere.info
frappe@vps:~/frappe-bench$
Disable maintenance mode,
bench --site dev1.domainhere.info set-maintenance-mode off
Setup production config,
sudo bench setup production dev.domainhere.info
Setup NGINX to apply the changes,
bench setup nginx
Install supervisor
using below command,
sudo apt install supervisor
Restart Supervisor and Launch Production Mode,
sudo supervisorctl restart all
sudo bench setup production [frappe-user]
If you are prompted to save the new/existing config file, respond with a Y.
When this completes doing the settings, your instance is now on production mode and can be accessed using your IP, without needing to use the port.
This also will mean that your instance will start automatically even in the event you restart the server.
Setup Let’s Encrypt SSL/TLS Certificates with NGINX
Install snapd and then certbot from snapd
apt install snapd -y
snap install core; snap refresh core
snap install --classic certbot
ln -s /snap/bin/certbot /usr/bin/certbot
Obtain the SSL/TLS Certificate
While installing Erpnext the frappe-bench.conf
file already created by system, so need to obtain the SSL/TCL Certificate,
sudo certbot --nginx -d dev.domainhere.info
Output:
Congratulations! You have successfully enabled https://dev.domainhere.info
-------------------------------------------------------------------------------------
IMPORTANT NOTES:
Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/dev.domainhere.info/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/dev.domainhere.info//privkey.pem
Navigate Erpnext
Done.
CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME
for 10% off!
1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month
Available Locations: LAX | MIA | ATL | FRA | AMS