ERPNext Setupbash

How to Install ERPNext on Ubuntu with the Easy Install Script

Install ERPNext

Step-by-step guide to installing a production-ready ERPNext instance on Ubuntu using the official `install.py` script. Covers different versions and common troubleshooting.

Installing ERPNext can seem daunting, but the Frappe team provides an 'Easy Install' script that automates most of the process on a fresh Ubuntu server. This script, `install.py`, handles the setup of all necessary dependencies like Python, Nginx, MariaDB, and Redis.

This guide walks you through using the script to set up a production-ready ERPNext instance, including options for specifying versions and handling common installation errors.

1# Step 1: Install Python and required packages
2sudo apt update && sudo apt upgrade -y
3sudo apt install python3-minimal build-essential python3-setuptools python3-pip
4
5# Step 2: Download the Easy Install script
6wget https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py
7
8# Step 3: Run the script for a production setup (replace 'ubuntu' with your non-root username)
9sudo python3 install.py --production --user ubuntu
10
11# --- OPTIONAL FLAGS ---
12
13# To install a specific version (e.g., version 13)
14sudo python3 install.py --production --user ubuntu --version 13
15
16# To specify site name, passwords, and bench name
17sudo python3 install.py --production --version 13 --user ubuntu --site erp.example.com --bench-name mybench --mysql-root-password 'your_sql_password' --admin-password 'your_admin_password'
18
19# --- TROUBLESHOOTING ---
20
21# In case of Ansible/Cryptography errors, run this before the install script:
22sudo -H python3 -m pip install setuptools cryptography ansible==2.8.5

Understanding This Code

What It Does

The script automates the installation of the entire Frappe and ERPNext stack, including system dependencies, bench CLI, a new Frappe site, and configuring Nginx and Supervisor for production use.

When To Use

Use this on a clean, fresh installation of a Debian-based Linux distribution like Ubuntu to set up a new ERPNext instance. It is the recommended method for new production or development environments.

Prerequisites

  • A fresh Ubuntu 20.04/22.04 server.
  • Root or sudo access.
  • A non-root user with sudo privileges.

Key Concepts

Important ideas to understand in this code

Bench CLI

Bench is the command-line interface for managing Frappe Framework applications. It's used for creating new sites, installing apps, updating, and running various administrative tasks.

Learn more

Easy Install Script (install.py)

A Python script provided by Frappe that uses Ansible playbooks to automate the entire setup process, ensuring all dependencies and configurations are correctly applied.

Learn more

Production vs. Develop Mode

The '--production' flag sets up Nginx, Supervisor, and Fail2Ban for a live, secure environment. The '--develop' flag is for a developer setup, which is easier to debug but not meant for public access.

Learn more

Step-by-Step Tutorial

Follow along to understand how this code works

1

Prepare the System & Install Dependencies

First, ensure your system is up-to-date and install the necessary Python packages and build tools required by the installation script.

bash
sudo apt update && sudo apt upgrade -y
sudo apt install python3-minimal build-essential python3-setuptools python3-pip
Next Step
2

Download the Easy Install Script

Download the official 'install.py' script from the Frappe Bench GitHub repository using 'wget'.

bash
wget https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py
Next Step
3

Execute the Installation Script

Run the script using 'sudo python3'. The '--production' flag is crucial for a live server. Replace 'your_user' with your non-root OS username. The script will install the latest version of ERPNext by default.

bash
sudo python3 install.py --production --user your_user
Next Step
4

Optional: Installing a Specific Version

If you need a specific version, like version 13, you can use the '--version' flag. You can also pre-define the site name, MySQL root password, and admin password directly.

bash
sudo python3 install.py --production --version 13 --user ubuntu --site erp.example.com --mysql-root-password 'your_sql_password' --admin-password 'your_admin_password'

Common Issues & Solutions

Troubleshoot problems you might encounter

0