This is a complete step-by-step guide to install ERPNext on a fresh Ubuntu 22.04 server. By the end you’ll have a fully working ERPNext instance ready for production.

Pre-requisites

Python 3.10+
Node.js 18
Redis 6+
MariaDB 10.6+
yarn 1.12+
pip 22+
wkhtmltopdf 0.12.6

STEP 1 Update and Upgrade Your Server

Always start with updating your package list and upgrading existing packages to the latest versions.

sudo apt-get update -y
sudo apt-get upgrade -y

STEP 2 Install Required Packages

Install Python, pip, and other essential packages that ERPNext depends on.

sudo apt-get install -y python3-dev python3-pip python3-setuptools python3-venv
sudo apt-get install -y software-properties-common git curl
sudo apt-get install -y libffi-dev libssl-dev libjpeg-dev
sudo apt-get install -y libmysqlclient-dev libcups2-dev

STEP 3 Install MariaDB

MariaDB is the database that ERPNext uses to store all your data. We need version 10.6 or higher.

sudo apt-get install -y mariadb-server mariadb-client

Secure your MariaDB installation. When prompted, set a strong root password and answer Y to all security questions.

sudo mysql_secure_installation

STEP 4 Configure MariaDB

ERPNext requires specific character encoding settings. Edit the MariaDB config file.

sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf

Add these lines under the [mysqld] section:

[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

Restart MariaDB to apply the changes.

sudo systemctl restart mariadb
sudo systemctl enable mariadb

STEP 5 Install Redis

Redis is used by ERPNext for caching, background job queuing, and real-time updates.

sudo apt-get install -y redis-server
sudo systemctl start redis-server
sudo systemctl enable redis-server

STEP 6 Install Node.js 18 and Yarn

Node.js is required for compiling JavaScript assets. We’ll use NodeSource to install version 18.

curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo npm install -g yarn

Verify the installation:

node --version
yarn --version

STEP 7 Install wkhtmltopdf

wkhtmltopdf is used by ERPNext to generate PDF invoices, reports, and print formats.

sudo apt-get install -y xvfb libfontconfig wkhtmltopdf

STEP 8 Install Frappe Bench

Bench is the CLI tool that manages Frappe and ERPNext installations. It handles everything from site creation to app deployment.

sudo pip3 install frappe-bench
bench --version

STEP 9 Create a Frappe Bench

Initialize a new bench directory. This will download Frappe framework and set up the folder structure.

bench init --frappe-branch version-15 frappe-bench
cd frappe-bench

STEP 10 Create a New Site

A site in Frappe is a separate database instance. You’ll be prompted to set an administrator password.

bench new-site mysite.local

IMPORTANT: If you get a collation error, run this in the MariaDB shell:

mysql -u root -p
SET GLOBAL collation_server = 'utf8mb4_unicode_ci';
exit;
sudo systemctl restart mariadb

STEP 11 Install ERPNext

bench get-app erpnext --branch version-15
bench --site mysite.local install-app erpnext

STEP 12 Start ERPNext

bench start

Your ERPNext instance is now running at:

http://localhost:8000

Login with Administrator and the password you set during site creation. You’re all set.

Share this article

Comments

Join the discussion. Got a question, found an issue, or want to share your experience?

Leave a Comment

Your email stays private. We just use it for replies.

Nothing to preview yet.

Use **bold**, *italic*, `code`, ```code blocks```, [link](url), > quote, - list