ERPNext in Production
- Atul
- Technology , Web , Free software , The big o community , Frappe , Erpnext
- May 23, 2025
Table of Contents
ERPNext in Production
๐ฐ The Kingdom of Frappe: A Developerโs Quest to Rule ERPNext!
Once upon a time, in the Land of Debian, a brave developer set forth to build their own ERP Kingdom using the mighty Frappe Framework and the legendary ERPNext.
This is their taleโฆ
โ๏ธ Chapter 1: Preparing the Kingdom (Prerequisites)
Before you can rule, you must fortify your castle (Debian system) with the right tools!
# ๐๏ธ Build the foundation (install dependencies)
sudo apt update && sudo apt upgrade -y
sudo apt install -y python3-dev python3-pip python3-setuptools python3-venv \
build-essential git mariadb-server mariadb-client redis-server \
curl software-properties-common libmysqlclient-dev libffi-dev \
libssl-dev cron sudo
# โก Power up with Node.js & Yarn (for the frontend magic)
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt install -y nodejs
sudo npm install -g yarn
# โ๏ธ The Royal Scribe (wkhtmltopdf for PDF reports)
sudo apt install -y wkhtmltopdf
๐ Chapter 2: Summoning the Bench (Installation)
The Bench is the scepter of powerโit commands Frappe and ERPNext!
# ๐ฐ Install the mighty Bench CLI
sudo pip3 install frappe-bench
# ๐๏ธ Forge a new Bench (a directory for your kingdom)
bench init frappe-bench --frappe-branch version-15
cd frappe-bench
# ๐ฏ Create your first castle (site)
bench new-site castle.localhost --mariadb-root-password StrongPassword123
๐ฎ Chapter 3: The ERPNext Scroll (Installing ERPNext)
Now, summon the legendary ERPNext to your kingdom!
# ๐ Fetch the ERPNext scroll (source code)
bench get-app erpnext https://github.com/frappe/erpnext --branch version-15
# ๐ Install ERPNext into your castle
bench --site castle.localhost install-app erpnext
๐ Chapter 4: Launching the Kingdom (Development Mode)
Time to raise the banners and start your reign!
# ๐ช Start the Frappe & ERPNext festival (development server)
bench start
๐ Huzzah! Your kingdom is now live at:
๐ http://localhost:8000
Login: Administrator
Password: (the one you set during new-site
)
โ๏ธ Chapter 5: Customizing Your Kingdom
A true ruler shapes their domain!
๐ ๏ธ Ways to Customize:
Create new Doctypes (Royal Decrees)
bench new-doctype "Tax Law"
Modify existing Doctypes (Edit the Royal Archives)
- Go to Developer Mode โ Customize Form
Build a Custom App (Found a New City!)
bench new-app trade_port bench --site castle.localhost install-app trade_port
๐ฐ Chapter 6: The Grand Deployment (Production)
Your kingdom must stand strong in the real world!
โ๏ธ Steps to Rule in Production:
Harden Your Castle (Security & Performance)
bench setup production king sudo bench setup nginx sudo bench setup supervisor
Raise the Moat (Firewall & SSL)
sudo apt install ufw -y sudo ufw allow 22,80,443 sudo ufw enable sudo certbot --nginx
Train the Guards (Automated Backups)
bench setup backups
Launch the Kingdom!
bench restart
๐ Long live the King/Queen! Your ERPNext kingdom is now live in production!
๐ Epilogue: The Developerโs Legacy
You have:
โ
Built a Frappe & ERPNext kingdom
โ
Customized it to your royal will
โ
Deployed it to rule forever
Now, go forth and conquer business automation! ๐
Need reinforcements? Ask in the Frappe Forum or ERPNext Community!
โ๏ธ The Endโฆ or Just the Beginning? โ๏ธ
๐ Dealing with Python’s Externally Managed Environment in Debian
Ah, the dreaded Debian Python protection spell! This is Debian’s way of preventing pip from making system-wide changes that could conflict with apt packages. Let me guide you through several ways to bypass this safely:
๐ก๏ธ Option 1: The Safe Way (Using Virtual Environment)
# Install required system packages
sudo apt install python3-venv python3-dev
# Create a virtual environment
python3 -m venv ~/frappe-env
# Activate the environment
source ~/frappe-env/bin/activate
# Now install frappe-bench safely
pip install frappe-bench
โ๏ธ Option 2: The Brave Way (Using –break-system-packages)
# Only do this if you understand the risks!
sudo -H pip3 install frappe-bench --break-system-packages
๐ง Option 3: The Wizard’s Way (Using pipx)
# First install pipx
sudo apt install pipx
pipx ensurepath
# Then install frappe-bench in its own isolated environment
pipx install frappe-bench
๐ฐ Option 4: The Debian-approved Way
# Install all dependencies first
sudo apt install python3-pip python3-setuptools python3-wheel
# Then use the --user flag to install locally
pip3 install --user frappe-bench
# Add local bin to PATH
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
๐ก Pro Tip:
After installation, verify with:
bench --version
Remember, the virtual environment method (Option 1) is the safest and most recommended approach for Frappe development. It keeps your system Python clean and prevents conflicts with Debian’s package manager.