Skip to content

Instantly share code, notes, and snippets.

@revant
Last active November 27, 2022 07:33
Show Gist options
  • Save revant/8d7ca46a873a3a5eb730483d0dd998be to your computer and use it in GitHub Desktop.
Save revant/8d7ca46a873a3a5eb730483d0dd998be to your computer and use it in GitHub Desktop.
Frappe/ERPNext version 14 on RHEL 8

Download and install offline

# for centos:8 docker container refer https://stackoverflow.com/a/70930049
# yumdownloader --assumeyes --destdir=$HOME/downloads/rpms --resolve {package-name}
sudo yum install -y --cacheonly --disablerepo=* $HOME/downloads/rpms/*.rpm
# Following command needs Python 3.10 installed. Refer Section below
sudo pip3.10 install --no-index --find-links file:$HOME/downloads/pip frappe-bench 

Install Python

sudo yum update –y
# For supervisor
sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo yum install git redis mariadb-server nginx supervisor
# For python 3.10 compilation
sudo yum install wget yum-utils make gcc openssl-devel bzip2-devel libffi-devel zlib-devel ncurses-devel readline-devel xz-devel sqlite-devel gdbm-devel libuuid-devel
# For wkhtmltopdf
sudo yum install xorg-x11-fonts-75dpi xorg-x11-fonts-Type1 libpng libpng15 libjpeg openssl icu libX11 libXext libXrender xorg-x11-fonts-Type1 xorg-x11-fonts-75dpi

Download and extract Python 3.10 source

sudo su
cd /opt
wget https://www.python.org/ftp/python/3.10.8/Python-3.10.8.tgz
tar xzf Python-3.10.8.tgz
rm Python-3.10.8.tgz
exit

Compile and Install

cd /opt/Python-3.10.8
sudo ./configure --with-system-ffi --with-computed-gotos --enable-loadable-sqlite-extensions --enable-optimizations --prefix=/usr
sudo make
sudo make install

Install NodeJS v16

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
. .bashrc
nvm install v16
npm i -g yarn

Configure MariaDB

sudo nano /etc/my.cnf.d/frappe.cnf # Add lines from frappe.cnf section below
sudo systemctl enable mariadb
sudo systemctl start mariadb
sudo mysql_secure_installation # set root password here. e.g. admin.

Add following lines to /etc/my.cnf.d/frappe.cnf file

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

[mysql]
default-character-set = utf8mb4

Install wkhtmltopdf

sudo yum install https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox-0.12.6.1-2.almalinux8.x86_64.rpm

Setup frappe-bench

bench init --version=version-14 --python=/usr/bin/python3.10 frappe-bench
cd frappe-bench
bench get-app --branch version-14 --resolve-deps erpnext
bench new-site --admin-password=admin --db-root-password=admin --install-app=payments --install-app=erpnext site1.local --set-default
bench setup supervisor
sudo ln -s `pwd`/config/supervisor.conf /etc/supervisord.d/frappe-bench.ini
sudo systemctl enable supervisord
sudo systemctl start supervisord
bench setup nginx
sudo cp `pwd`/config/nginx.conf /etc/nginx/conf.d/frappe-bench.conf
sudo nano /etc/nginx/nginx.conf # set: user root;
# Note: When you (re)start nginx after the configuration change, it might fail if you have another configuration with server block as default for port 80 (in most cases for the nginx welcome page). You will have to disable this config. Most probable places for it to exist are `/etc/nginx/nginx.conf` and `/etc/nginx/nginx.conf.default`. Comment lines with `listen`.
sudo systemctl enable nginx
sudo systemctl start nginx

Troubleshoot

If nginx shows permission denied

# https://stackoverflow.com/a/30952561
# yum install -y policycoreutils-devel # execute if policycoreutils-devel not installed
grep nginx /var/log/audit/audit.log | audit2allow -M nginx
semodule -i nginx.pp
# Or disable selinux for nginx https://www.nginx.com/blog/using-nginx-plus-with-selinux
semanage permissive -a httpd_t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment