Install ERPNext 15 on AlmaLinux - ashish-greycube/help GitHub Wiki

Step 1: Update the System

We need to update the system packages to their latest version available before installation of ERPNext.

sudo dnf update -y && sudo dnf upgrade -y

Step 2: Install Dependencies

To install the required dependencies, execute the following command:

sudo yum groupinstall "Development Tools" -y
sudo yum install epel-release gcc make git openssl-devel zlib-devel bzip2-devel libffi-devel xz-devel redis -y

After installation of the required dependencies, start and enable the Redis service.

sudo systemctl start redis && sudo systemctl enable redis

Then install Supervisor

sudo yum -y install supervisor
pip install supervisor

Step 3. Install Python

The latest version of ERPNext requires python version 3.12. To install the Python 3.12 version, execute the following commands:

cd /opt

wget https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tar.xz
     
tar -xvf Python-3.12.0.tar.xz

rm Python-3.12.0.tar.xz

cd Python-3.12.0

./configure --enable-optimizations && make altinstall

After installation, make a symbolic link

ln -s /usr/local/bin/python3.12 /usr/bin/python3  

[!NOTE] Sometime the above command will give output like "The Symbolic Link is Already Created!!"

Check the installed version with the following command:

python3 -V

You should receive the following output:

[root@host Python-3.12.0]# python3 -V
Python 3.12.0

[!NOTE] If the Output is Not Same then Just run the following command to remove symbolic link, and create new link then check the version.

If there was already a symbolic link, just remove it with the following command:

rm -f /usr/bin/python3

Now, install pip3 and wheel dependencies with the newly installed Python3.12 version:

python3 -m pip install --upgrade pip setuptools wheel

Step 4: Install wkhtmltopdf

Install the Required Dependencies for wkhtmltopdf

sudo yum install -y xorg-x11-fonts-75dpi xorg-x11-fonts-Type1 libpng libjpeg openssl icu libX11 libXext libXrender xorg-x11-fonts-Type1 xorg-x11-fonts-75dpi

Download the rpm package from github

wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox-0.12.6.1-2.almalinux9.x86_64.rpm

Install the package

sudo dnf install ./wkhtmltox-0.12.6.1-2.almalinux9.x86_64.rpm

Step 5: Install the MariaDB database server

Installing the latest version of MariaDB 10.6 is straightforward using the official bash script, as any updates will be instant once deployed to the official repositories.

First, ensure the curl package is installed using the following command.

sudo dnf install curl -y

Next, in your terminal, use the following command(Import MariaDB 10.6 Repository).

curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version=10.6

sudo dnf install mariadb-server mariadb

Alternatively, you can install the following extras.

sudo dnf install mariadb-backup MariaDB-devel -y

Confirm the installation of MariaDB by checking the version and build.

mariadb --version

Example output:

mariadb  Ver 15.1 Distrib 10.6.9-MariaDB, for Linux (x86_64) using  EditLine wrapper

Start and enable the mariadb.service with the following commands:

sudo systemctl start mariadb && sudo systemctl enable mariadb

Check the status of the mariadb.service

sudo systemctl status mariadb

You should receive the following output:

[root@host]# sudo systemctl status mariadb
● mariadb.service - MariaDB 10.6.9 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2023-02-10 03:59:54 CST; 20s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
 Main PID: 47326 (mysqld)
   Status: "Taking your SQL requests now..."
    Tasks: 30 (limit: 23666)
   Memory: 87.4M
   CGroup: /system.slice/mariadb.service
           └─47326 /usr/libexec/mysqld --basedir=/usr

Feb 10 03:59:50 host.test.vps systemd[1]: Starting MariaDB 10.3 database server...
Feb 10 03:59:50 host.test.vps mysql-prepare-db-dir[47223]: Initializing MariaDB database
Feb 10 03:59:54 host.test.vps mysqld[47326]: 2023-02-10  3:59:54 0 [Note] /usr/libexec/mysqld (mysqld 10.3.35-MariaDB) starting as 
     process 47326 ...
 Feb 10 03:59:54 host.test.vps systemd[1]: Started MariaDB 10.3 database server.

We must secure the database instance and set MySQL root password:

mysql_secure_installation  OR mariadb-secure-installation

Follow the steps to secure the database: Enter current password for root (enter for none): Hit Enter

Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!

Remove anonymous users? [Y/n] Y

Disallow root login remotely? [Y/n] Y

Remove test database and access to it? [Y/n] Y

Reload privilege tables now? [Y/n] Y

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!
Save the MySQL root password since you will need it while installing ERPNext.

Next, we need to add the lines of code below in /etc/my.cnf file:

sudo yum install nano
sudo nano /etc/my.cnf

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

[mysql]
default-character-set = utf8mb4

After adding these lines, restart the MariaDB service:

sudo systemctl restart mariadb

Step 6: Create Frappe User

First, create an Frappe user, add to the wheel group, and set a password.

sudo useradd -m frappe -G wheel

sudo passwd frappe

Changing password for user erpnext.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.

Then gives all the permission to the user

chmod -R o+rx /home/frappe

Switch to the frappe user

su - frappe

Go into the /home directory of the frappe user:

cd /home/frappe/

Step 7: Install NodeJS

ERPNext’s latest version, 15, requires a newer NodeJS version, such as NodeJS 18. To install nodejs execute the following command:

sudo yum module list nodejs 

sudo yum module enable nodejs:18

sudo yum install nodejs -y

After installation, check the Node and NPM versions with the following command:

node -v && npm -v

You should get the following output:

[root@host]# node -v && npm -v
v18.**.**
8.19.2

After nodejs installation, we will install Yarn:

sudo npm install -g yarn

Check the installed Yarn version with the yarn -v command:

[root@host]# yarn -v
1.22.19

Install the Frappe bench version 15 with the following command:

pip3 install --user frappe-bench

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

After the successful installation of the bench, you will receive the following output:

frappe/dist/js/
β”œβ”€ bootstrap-4-web.bundle.22U72DEL.js                       1.73 Kb
β”œβ”€ controls.bundle.RQCO7PK6.js                              1228.26 Kb
β”œβ”€ data_import_tools.bundle.ZHGGYJ52.js                     106.10 Kb
β”œβ”€ desk.bundle.VYQDF5SY.js                                  1414.14 Kb
β”œβ”€ dialog.bundle.X36Y7A7S.js                                53.07 Kb
β”œβ”€ form.bundle.6OYSHLE3.js                                  153.69 Kb
β”œβ”€ frappe-web.bundle.W6O5MTCM.js                            949.60 Kb
β”œβ”€ libs.bundle.YZMCKPNH.js                                  574.13 Kb
β”œβ”€ list.bundle.RERWMHEV.js                                  185.53 Kb
β”œβ”€ logtypes.bundle.7STJ7YLS.js                              0.73 Kb
β”œβ”€ recorder.bundle.5AOEUOFD.js                              179.54 Kb
β”œβ”€ report.bundle.IQ4SSISM.js                                170.93 Kb
β”œβ”€ user_profile_controller.bundle.YR6XHZRM.js               11.35 Kb
β”œβ”€ video_player.bundle.UO3KNN5D.js                          120.59 Kb
β”œβ”€ web_form.bundle.75LN4HKD.js                              1562.54 Kb
β”œβ”€ print_format_builder.bundle.KP4FAW42.js                  170.39 Kb
β”œβ”€ build_events.bundle.L2HAVD4K.js                          11.62 Kb
└─ kanban_board.bundle.VCVKXCPT.js                          27.42 Kb

frappe/dist/css/
β”œβ”€ desk.bundle.MBTR4LD7.css                                 547.98 Kb
β”œβ”€ email.bundle.D7YLNAJF.css                                4.02 Kb
β”œβ”€ login.bundle.6T5NJHU5.css                                24.88 Kb
β”œβ”€ print.bundle.N3SFSER3.css                                196.28 Kb
β”œβ”€ print_format.bundle.JH7UBL6H.css                         178.93 Kb
β”œβ”€ report.bundle.HWLJLFER.css                               5.36 Kb
β”œβ”€ web_form.bundle.YDYF7I73.css                             14.73 Kb
└─ website.bundle.IPR4YLHZ.css                              422.09 Kb

frappe/dist/css-rtl/
β”œβ”€ desk.bundle.PZAWYDHE.css                                 548.23 Kb
β”œβ”€ email.bundle.HU2YKLCX.css                                4.02 Kb
β”œβ”€ login.bundle.FLH267FT.css                                24.88 Kb
β”œβ”€ print.bundle.ALDGUYEF.css                                196.43 Kb
β”œβ”€ print_format.bundle.3QFLLY7D.css                         179.05 Kb
β”œβ”€ report.bundle.LY72JI7U.css                               5.35 Kb
β”œβ”€ web_form.bundle.L26SZB7K.css                             14.72 Kb
└─ website.bundle.355E5L7G.css                              422.24 Kb

DONE  Total Build Time: 41.861s
Done in 45.98s.
SUCCESS: Bench frappe-bench initialized

Next is to create the website:

cd frappe-bench

bench new-site YourDomainName

The installation will ask for the MySQL root password, and you will need to set up a password for the administrator</b login user.

[frappe@host frappe-bench]$ bench new-site YourWebsiteName
MySQL root password:
Updating DocTypes for frappe        : [========================================] 100%
Updating country info               : [========================================] 100%
Set Administrator password:
Re-enter Administrator password:
*** Scheduler is disabled ***

Enable the scheduler:

bench --site YourDomainName enable-scheduler

Once the scheduler is enabled, we need to get the ERPNext app and install it with the following commands:

bench get-app erpnext --branch version-15

bench --site YourDomainName  install-app erpnext

Step 8: Setup Production Mode

Now, we can install the bench in production mode with the following substeps:

pip3 install frappe-bench

Next, we will install Nginx:

sudo yum install nginx -y

Save the file, close it, and start both services:

sudo systemctl start nginx && sudo systemctl enable nginx

sudo systemctl start supervisord && sudo systemctl enable supervisord

If Error Occur Like this: Job for supervisord.service failed because the control process exited with error code then run following Command on Root Directory, If not then continue to Create Symbolic Link.

pip install supervisor

Then run both command again

sudo systemctl start nginx && sudo systemctl enable nginx

sudo systemctl start supervisord && sudo systemctl enable supervisord

Once the services are enabled, create the symbolic links for Nginx, Supervisor, and Python3.12 again:

sudo ln -s `pwd`/config/supervisor.conf /etc/supervisord.d/frappe-bench.ini

sudo ln -s `pwd`/config/nginx.conf /etc/nginx/conf.d/frappe-bench.conf

sudo rm /usr/bin/python3

sudo ln -s /usr/local/bin/python3.12 /usr/bin/python3

Once the symbolic links are set, setup nginx and supervisor with the following commands:

bench setup supervisor

bench setup nginx

You should get the following output:

Site YourWebsiteDomain assigned port: 80

The last thing is to restart the services:

sudo systemctl restart supervisord

sudo systemctl restart nginx

sudo supervisorctl start all

Now, you can access your website at http://YourWebsiteDomain using administrator as username and the password you set above.