Installing ERPNext 14 on Ubuntu 22.04

ERPNext is a promising Open Source ERP solutions that, unlike similar products such as Odoo is completely Open Source and as such does not require paying modules to use all its functionalities. ERPNext is built on the Frappé Framework that can be managed with the cli tool “bench”. Although somewhat cumbersome, installation is not really difficult, but must be done in a specific order to get it working. In this tutorial, we will go through the procedure step by step.

We assume you have a fresh installation of Ubuntu 22.04 available that we still need to update and upgrade to make sure we are using the latest packages.

# apt update && apt upgrade -y

Now we are ready to install all the required packages for ERPNext.

# apt install git python3-dev python3.10-dev python3-setuptools python3-pip python3-distutils python3.10-venv software-properties-common mariadb-server mariadb-client redis-server xvfb libfontconfig wkhtmltopdf libmysqlclient-dev npm -y

Run the MySQL secure installation script.

# mysql_secure_installation
Enter current password for root: (Enter your SSH root user password)
Switch to unix_socket authentication [Y/n]: Y
Change the root password? [Y/n]: Y
It will ask you to set new MySQL root password at this step. This can be different from the SSH root user password.
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n]: N
This is set as N because we might want to access the database from a remote server for using business analytics software like Metabase / PowerBI / Tableau, etc.
Remove test database and access to it? [Y/n]: Y
Reload privilege tables now? [Y/n]: Y

Make the necessary changes to the MariaDB configuration files.

# vi /etc/mysql/mariadb.conf.d/50-server.cnf
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation_server = utf8mb4_unicode_ci

And also comment out the following.

#character-set-server = utf8mb4
#collation-server = utf8mb4_general_ci
# vi /etc/mysql/mariadb.conf.d/50-client.cnf
default-character-set = utf8mb4

Restart MariaDB to apply the modifications.

# systemctl restart mariadb

Create a new directory “/opt/erpnext”.

# mkdir -p /opt/erpnext

Create a new user “erpnext”.

# useradd -m -s /bin/bash erpnext

Add a strong password.

# passwd erpnext

Add new user “erpnext” to the “sudo” group

# usermod -aG sudo erpnext

Now change the owner of the “/opt/erpnext/” directory to “erpnext”.

# chown -R erpnext /opt/erpnext/

Switch to the “erpnext” user.

# su - erpnext

Add path to the “.bashrc” file.

$ tee -a ~/.bashrc<<EOF

Switch into the “/opt/erpnext/” directory.

$ cd /opt/erpnext/

Install nvm.

$ curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash

Read the “.profile” file.

$ source ~/.profile

Install Node.js (version 16.15.0).

$ nvm install 16.15.0

Install Yarn package manager.

$ sudo npm install -g yarn

Install Frappé with bench.

$ sudo pip3 install frappe-bench

Install the python package of Redis.

$ sudo pip3 install redis

Use “bench” to set-up for Frappé.

$ bench setup redis

Initialize Frappé Bench

$ bench init --frappe-branch version-14 frappe-bench

Switch into the Frappe Bench directory.

$ cd frappe-bench

Change user directory permissions giving the bench user execution permission to the home directory.

$ chmod -R o+rx /opt/erpnext/

Create a new site.

$ bench new-site erp.mysite.com
MySQL root password:

Installing frappe...
Updating DocTypes for frappe        : [========================================] 100%
Updating country info               : [========================================] 100%
Set Administrator password:
Re-enter Administrator password:
Updating Dashboard for frappe
erp.mysite.com: SystemSettings.enable_scheduler is UNSET
*** Scheduler is disabled ***

Use “bench” to install the “payments” app which is required to set up ERPNext.

$ bench get-app payments

And now install the “ERPNext” app.

$ bench get-app --branch version-14 erpnext

Install the “ERPNext” app to your domain.

$ bench --site erp.mysite.com install-app erpnext

Instruct Frappé to use your domain.

$ bench use erp.mysite.com

And finally start bench.

$ bench start

Now you should be able to login in your brouwser http://your-erpnext-server- ip:8000 using “Administrator” as user and the password you entered during the installation process.

Switching to production environment.

$ sudo bench setup production erpnext

And after this has finish perform a second time

$ sudo bench setup production erpnext

And answer with yes “y” twice to continue.

Setting Up prerequisites...
Setting Up supervisor...
supervisor.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
Setting Up NGINX...
nginx.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
Port configuration list:

Site erp.yoursite.com assigned port: 80

Now your site should be available on both ip and domain (fqdn).

Similar Posts