Warning: Trying to access array offset on value of type bool in /mnt/KDJ-SH-SGB-STORAGE-1/kdjayako/public_html/wp-content/plugins/pro-elements/modules/dynamic-tags/tags/post-featured-image.php on line 39

Warning: Trying to access array offset on value of type bool in /mnt/KDJ-SH-SGB-STORAGE-1/kdjayako/public_html/wp-content/plugins/pro-elements/modules/dynamic-tags/tags/post-featured-image.php on line 39

Warning: Trying to access array offset on value of type bool in /mnt/KDJ-SH-SGB-STORAGE-1/kdjayako/public_html/wp-content/plugins/pro-elements/modules/dynamic-tags/tags/post-featured-image.php on line 39

Warning: Trying to access array offset on value of type bool in /mnt/KDJ-SH-SGB-STORAGE-1/kdjayako/public_html/wp-content/plugins/pro-elements/modules/dynamic-tags/tags/post-featured-image.php on line 39

KD Jayakody

Call Us: 076 72 33 595


Warning: Trying to access array offset on value of type bool in /mnt/KDJ-SH-SGB-STORAGE-1/kdjayako/public_html/wp-content/plugins/pro-elements/modules/dynamic-tags/tags/post-featured-image.php on line 39

How to Install ERPNext 14 on CentOS 8

Dec 22, 2022

ERPNext is a powerful open-source enterprise resource planning (ERP) platform that helps businesses manage their financial, inventory, and operations. In this tutorial, we will show you how to install ERPNext 14 on a CentOS 8 server.

Prerequisites

Before you begin, you will need the following:

  • A server running CentOS 8.
  • A user account with sudo privileges.

Step 1: Update the system

It’s always a good idea to update your system before installing any new software. Run the following commands to update the system:

sudo yum update
sudo yum upgrade

Step 2: Install the dependencies

ERPNext requires a number of dependencies to be installed on the system. Run the following command to install the dependencies:

sudo yum install epel-release python3 python3-pip mariadb mariadb-server nginx

Step 3: Start and enable the MariaDB service

ERPNext uses a MariaDB database to store its data. Start the MariaDB service and enable it to start automatically on boot:

sudo systemctl start mariadb
sudo systemctl enable mariadb

Step 4: Secure the MariaDB installation

Run the following command to secure the MariaDB installation:

sudo mysql_secure_installation

Follow the prompts to set a root password, disable anonymous users, and remove test databases.

Step 5: Create a MariaDB user and database for ERPNext

Log in to the MariaDB shell as the root user:

mysql -u root -p

Enter the root password when prompted.

In the MariaDB shell, create a new MariaDB user and database for ERPNext:

CREATE DATABASE erpnext; CREATE USER 'erpnext'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON erpnext.* TO 'erpnext'@'localhost'; FLUSH PRIVILEGES;

Replace password with a strong password of your choice.

Step 6: Install ERPNext

Now that we have all the dependencies and database in place, we can install ERPNext.

First, create a new system user for ERPNext:

sudo useradd -m -d /opt/erpnext -U erpnext

Next, switch to the erpnext user:

sudo su - erpnext

Install the ERPNext framework using pip:

pip3 install --upgrade frappe-bench

Create a new ERPNext bench:

bench init erpnext

Change into the ERPNext directory:

cd erpnext
Install ERPNext:
bench get-app erpnext https://github.com/frappe/erpnext.git
Step 7: Configure ERPNext
Before we can start using ERPNext, we need to create a configuration file for it. Run the following command to create a sample configuration file:
bench new-site site1.local

This will create a new ERPNext site in the sites directory. Open the sites/site1.local/site_config.json file in a text editor and make the following changes:

  • Set the db_name field to erpnext.
  • Set the db_password field to the password you set for the erpnext MariaDB user in Step 5.
  • Set the admin_password field to a password of your choice. This will be the password for the ERPNext administrator account.

Save the file and exit the text editor.

Step 8: Install the ERPNext dependencies

Run the following command to install the dependencies for ERPNext:

bench install-app erpnext

This may take a few minutes to complete.

Step 9: Set up Nginx as a reverse proxy

We will use Nginx as a reverse proxy to serve ERPNext over HTTPS.

First, create an SSL certificate and private key for your domain:

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/erpnext.key -out /etc/ssl/certs/erpnext.crt

Next, create a new Nginx configuration file for ERPNext:

sudo nano /etc/nginx/conf.d/erpnext.conf

Paste the following configuration into the file, replacing your_domain.com with your actual domain name:

server {
listen 80;
server_name your_domain.com;
return 301 https://$server_name$request_uri;
}

server {
listen 443 ssl;
server_name your_domain.com;

ssl_certificate /etc/ssl/certs/erpnext.crt;
ssl_certificate_key /etc/ssl/private/erpnext.key;

location / {
proxy_pass http://localhost:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}

Save the file and exit the text editor.

Test the Nginx configuration:

sudo nginx -t

If the configuration is valid, restart Nginx:

sudo systemctl restart nginx

Step 10: Start ERPNext

To start ERPNext, run the following command:

bench start

This will start the ERPNext server and make it available at https://your_domain.com.

Step 11: Set up a cron job

ERPNext uses a cron job to run scheduled tasks. Run the following command to set up the cron job:

Recent Posts