Discussion – 

0

Discussion – 

0

Build Frappe ERPNext in Python virtual environment – Native Installation

🔧 Step 1: Update the Server
Start by updating your package list to ensure you install the latest available versions:
# apt update

👤 Step 2: Create a New User for Frappe
Create a dedicated user called frappe to manage your ERPNext setup:
# adduser frappe

add the user frappe to sudo group
# usermod -aG sudo frappe

switch to user frappe
# su - frappe

📦 Step 3: Install Required Dependencies
Install the essential software: Git, Python, Redis, MariaDB, Node.js, Nginx, and others:
$ sudo apt install git python-is-python3 python3-dev python3-pip redis-server libmariadb-dev mariadb-server mariadb-client pkg-config python3.12-venv xvfb libfontconfig certbot python3-certbot-nginx  -y

🛡️ Step 4: Secure and Configure MariaDB
Secure your database:
$ sudo mariadb-secure-installation

configure the mariadb and add the parameters in the file
$ sudo vim /etc/mysql/my.cnf

[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
[mysql]
default-character-set = utf8mb4

:wq! save and exit

restart mariadb
$ sudo systemctl restart mariadb

🌐 Step 5: Install Node.js and Yarn
Use NVM (Node Version Manager) to install Node.js:
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
$ source ~/.profile
$ nvm install 23

check version
$ node -v

Install Yarn
$ npm install -g yarn
$ npm install -g npm@11.4.2

📄 Step 6: Install wkhtmltopdf
Frappe uses this to generate PDFs:
$ wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb
$ sudo dpkg -i wkhtmltox_0.12.6.1-2.jammy_amd64.deb
$ sudo apt install -f -y

🐍 Step 7: Set Up Python Virtual Environment
Create and activate a virtual environment myvenv :
$ python3 -m venv myenv

activate the python virtual environment
$ source myenv/bin/activate

🧱 Step 8: Install and Initialize Frappe Bench
Install frappe-bench – the CLI tool to manage sites and apps:
$ pip3 install frappe-bench

check the version
$ bench --version
$ bench setup procfile

start the bench
$ bench start

initiate the bench
$ bench init --frappe-branch version-15 frappe-bench

navigate to the bench directory
$ cd frappe-bench/

🔐 Step 9: Set Permissions and Install Ansible

$ chmod -R o+rx /home/frappe/

install ansible
$ pip3 install ansible

🌍 Step 10: Create a New Site and Add ERPNext App
Create your Frappe site:
$ bench new-site frappe-erpnext.yoursite.in

add the site to hosts
$ bench --site frappe-erpnext.yoursite.in add-to-hosts

Download ,  Build and install ERPNext app:
$ bench get-app --branch v15.67.0 https://github.com/frappe/erpnext.git

install the erpnext app in the site
$ bench --site frappe-erpnext.yoursite.in install-app erpnext

set the app in production mode
enable the scheduler and disable maintenance mode:
$ bench --site frappe-erpnext.yoursite.in enable-scheduler

disable the maintanance mode
$ bench --site frappe-erpnext.yoursite.in set-maintenance-mode off

⚙️ Step 11: Setup Production Configuration
Set up Python path and sudo access:
$ bench setup env --python PATH="$PATH"

set sudo access to the user in venv
$ sudo -E env PATH="$PATH" bench setup sudoers $(whoami)

Set up production environment:
$ sudo -E env PATH="$PATH" bench setup production frappe

Setup and reload NGINX
reload the nginx
$ sudo systemctl reload nginx

Setup NGINX to apply the changes
$ bench setup nginx

Restart Supervisor and finalize production mode
$ sudo supervisorctl restart all
$ sudo -E env PATH="$PATH" bench setup production frappe

reload the nginx
$ sudo systemctl reload nginx

🔐 Step 12: Secure Your Site with Let’s Encrypt
Add SSL using Certbot
$ sudo certbot --nginx

check with
https://frappe-erpnext.yoursite.in

Conclusion
By the end of this guide, you’ve set up a production-grade ERPNext v15 server on Ubuntu, complete with NGINX, Supervisor, SSL, and isolated environments. This setup is powerful for small to mid-sized businesses looking for a robust ERP without SaaS vendor lock-in.

Ravenan Team

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

You May Also Like

No Results Found

The page you requested could not be found. Try refining your search, or use the navigation above to locate the post.