How to Install ERPNext Version 15 on Ubuntu 24

Here is a step-by-step guide for installing Frappe ERPNext Version 15 on Ubuntu 24. Follow the given instructions to set up a robust ERPNext environment on your Ubuntu server.

 · 5 min read

Installation Process

Overview

Before we dive into the installation process, ensure you have Ubuntu 24 installed on your virtual machine or hosted server. You can follow the instructions below either directly in your Ubuntu terminal or by connecting via SSH using a tool like VS Code and running the commands in the integrated terminal.

This guide will walk you through the complete process of setting up ERPNext Version 15 on your Ubuntu 24 system.


To address and resolve troubleshooting issues Click Here

Step 1: Initial Setup

1.1. Update and Upgrade Packages

First, update your package list and upgrade your installed packages to ensure you’re starting with the latest versions.

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

1.2. Create a New User

create a new user for running the Frappe Bench.

sudo adduser [frappe-user]
 usermod -a -G sudo [frappe-user] 
 su [frappe-user] 
 cd /home/[frappe-user]

Step 2: Install Prerequisites

2.1. Install Git

Git is required for version control and to clone repositories.

sudo apt-get install git

2.2. Install Python and Development Tools

Install Python 3.12 and its development tools.

sudo apt-get install python3-dev python3.12-dev python3-setuptools python3-pip

2.3. Install Python Virtual Environment

Set up a virtual environment for Python 3.12.

sudo apt-get install python3.12-venv

2.4. Install Common Software Properties

Install the necessary software properties.

sudo apt-get install software-properties-common

2.5. Install MariaDB

MariaDB is the database management system used by ERPNext.

sudo apt install mariadb-server mariadb-client

2.6.Install Redis Server

Redis is used for caching and background job processing.

sudo apt-get install redis-server

2.7. Install HTML to PDF Conversion Tools

These tools are used to convert HTML pages into PDF files, often for generating reports or documents.

sudo apt-get install xvfb libfontconfig wkhtmltopdf

2.8. Install MySQL Client Development Libraries

This installs libraries needed to develop and compile MySQL client applications, which are essential for interacting with MySQL databases.

sudo apt-get install libmysqlclient-dev

Step 3: Configure MySQL

3.1. Secure MySQL Installation

Run the following command to secure your MySQL installation:

sudo mysql_secure_installation

Follow the prompts:

  • Enter your current password for root (enter for none): Press "Enter" if no password is set.
  • Switch to unix_socket authentication [Y/N]: Y
  • Change the root password [Y/n]: Y (if desired)
  • Remove anonymous user [Y/N]: Y
  • Disallow root login remotely? [Y/n]: N
  • Remove test database and access to it? [Y/n]: Y
  • Reload privilege tables now? [Y/n]: Y

3.2. Modify MySQL configuration file

Open the MySQL configuration file for editing:

sudo nano /etc/mysql/my.cnf

Add the following lines to the configuration file:

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

 [mysql]
 default-character-set = utf8mb4

Step 4: Install Additional Software Dependencies

4.1. Install Curl

Curl is required for downloading files and setting up Node.js.

sudo apt install curl

4.2. Install Node.js

Use NVM (Node Version Manager) to install Node.js version 18.

curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
    
 source ~/.profile
 
 nvm install 18

4.3. Install npm

Install npm, the Node.js package manager.

sudo apt-get install npm

4.4. Install Yarn

Install Yarn, a fast and reliable JavaScript package manager.

sudo npm install -g yarn

Step 5: Install Frappe Bench

5.1. Install Frappe Bench

Quickly set up your Frappe development environment with this command:

sudo pip3 install frappe-bench --break-system-packages

5.2. Initialize Frappe Bench with a Specific Version

Initialize Frappe Bench using version 15.

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

5.3. Set Permissions for the User Directory

Make sure the user has the correct permissions to access their home directory.

chmod -R o+rx /home/[frappe-user]

Step 6: Create a New Site

6.1. Create a new site

Set up a new site with the following command.

bench new-site [site-name]

6.2. Install ERPNext Version 15

Add and install ERPNext version 15 on your new site.

bench get-app --branch version-15 erpnext
bench install-app erpnext

Step 7: Prepare Your Site for Production

7.1. Enable Scheduler

Activate the scheduler for your site.

bench --site [site-name] enable-scheduler

7.2. Set Maintenance Mode off

Disable maintenance mode to make your site accessible.

bench --site [site-name] set-maintenance-mode off

Step 8: Set Up the Virtual Environment

8.1. Install Python Virtual Environment

Run the following command to install and configure the Python virtual environment if it hasn't been set up already.

sudo apt install python3-venv
python3 -m venv env

8.2. Activate your virtual environment

source env/bin/activate

Step 9: Install and Configure Additional Tools

9.1. Install Ansible (Python Package)

Install Ansible to manage automation tasks.

sudo /usr/bin/python3 -m pip install ansible --break-system-packages

9.2. Install Fail2ban

Set up Fail2ban to enhance security.

sudo apt install fail2ban

Step 10: Install and Configure Nginx and Supervisor

10.1. Install Nginx

Update your package list and install Nginx.

sudo apt update
 sudo apt install nginx

10.2. Install and setup Supervisor

Install Supervisor to manage processes.

sudo apt update && sudo apt install supervisor

Step 11: Set Up Production Environment

Finally, set up the production environment using the following command:

sudo bench setup production [frappe-user]

And that’s it! You’ve successfully installed ERPNext Version 15 on Ubuntu 24. Your system is now ready for use.

Step 12: Install Standard and Custom Apps from GitHub(Optional)

12.1. Install a Standard App

To install a standard app from the Frappe ecosystem, run:

bench get-app --branch [branch-name or version] [app name]

12.2. Install a Custom App from GitHub

For a custom app hosted on GitHub, use:

bench get-app --branch [branch-name] [app-name] [github remote link]

12.3. Install an App on Your Site

To install the app on your specific site:

bench --site [site-name] install-app [app-name]

Error Troubleshooting Guide

1. Internal Server Error


Possible Causes:

  • The MySQL database may not be active or may have encountered an error.
  • The hooks.py file may contain incorrect code.
  • Solution 1: Database Migration

    Run the following command to perform a database migration:

    bench migrate

    Review any errors encountered during the migration process.

    Solution 2: Check MySQL Status

    Check the status of MySQL with the following command:

    sudo service mysql status

    If the status is not active, restart MySQL with the following commands:

    sudo service mysql stop
     sudo service mysql start

    2. Sorry! We will be back soon.



    Possible Reason:

  • This error occurs when the Supervisor service is not working.
  • Solution: Restart Supervisor

    Restart the Supervisor service with the following command:

    bench restart
      Or
     sudo supervisorctl restart all

    3. This site can't be reached


    Possible Causes:

  • There could be issues with the fail2ban service.
  • The Nginx web server may not be running or could be misconfigured.
  • Solution 1: Stop fail2ban Service

    1. Stop the fail2ban service by running:
    2. sudo service fail2ban stop

    Solution 2: Check Nginx Status

    1. Verify the status of Nginx:
    2. sudo service nginx status
    3. If Nginx is not active or functioning properly, restart the service:
    4. sudo service nginx stop
       sudo service nginx start

    Ready To Unleash The Power of ERPNext?

    We might just be the right partner you need.


    No comments yet.

    Add a comment
    Ctrl+Enter to add comment