[DEBIAN 11 - python3.10 Fixed] Erpnext 13 & Dev14+ DEVELOPMENT & PRODUCTION

https://www.youtube.com/watch?v=4v4zs8TWleY :cowboy_hat_face:

ERPNext 12 ubuntu 20

ERPNext 13 ubuntu 22

ERPNext 14 ubuntu 22

ERPNext DEV-14+ ubuntu 22
.

:boom: NOTES :boom:

:small_blue_diamond: SHOULD USE SUGGESTED SYSTEM

because of python versions and frappe dependencies other systems might dont work

:small_blue_diamond: SHOULD BE ONLY 2 USERS IN SYSTEM [ root & frappe ]

you can use any other user other then frappe

:small_blue_diamond: ROOT & FRAPPE PASSWORDS SHOULD BE SAME AS MARIADB

you can use any other password other then frappe07

:small_blue_diamond: SERVER SHOULD BE UPGRADED BEFORE START INSTALLATION

.
.

:anger: DEVELOPMENT SETUP

sudo apt-get clean -y
sudo apt-get autoremove -y
sudo apt --fix-broken install -y
sudo dpkg --configure -a
sudo apt-get install -f
sudo apt-get update && sudo apt-get upgrade

root@deb11

su - root

:small_blue_diamond: FIREWALL

ufw allow 22,25,143,80,443,3306,3022,8000/tcp
ufw enable

:small_blue_diamond: REQUIRED TOOLS

apt-get install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev

wget https://www.python.org/ftp/python/3.10.6/Python-3.10.6.tgz
tar -xvf Python-3.10.6.tgz
cd Python-3.10.6
./configure --enable-optimizations

make install

update-alternatives --install /usr/bin/python python /usr/local/bin/python3.10 1

reboot

CHECK PYTHON VERSION MUST BE 3.10.6

root@ip-172-31-25-43:~# python3

Python 3.10.6 (main, Aug 20 2022, 06:48:01) [GCC 10.2.1 20210110] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

INSTALLATION TOOLS CONTINUE

apt-get install git python2-dev python3-dev python3-setuptools python3-pip python3-distutils redis-server -y

apt-get install python3-venv -y
apt-get update -y
apt-get install xvfb libfontconfig wkhtmltopdf -y

:small_blue_diamond: MARIADB

SET YOUR ROOT PASSWORD HERE

sudo passwd root
password: frappe07

apt-get install mariadb-server mariadb-client -y

mysql_secure_installation

Switch to unix_socket authentication [Y/n] n
Change the root password? [Y/n] y
password: frappe07
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

set root password. THIS IS MUST

mysql -u root -p
USE mysql;
ALTER USER root@localhost IDENTIFIED VIA mysql_native_password;
SET PASSWORD = PASSWORD(‘frappe07’);
***GIVE THE PASSWORD AS ABOVE IN mysql_secure_installation SETUP
FLUSH PRIVILEGES;
exit

nano /etc/mysql/my.cnf

**add these lines @end of the file

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

[mysql]
default-character-set = utf8mb4

service mysql restart
sudo reboot

frappe@deb11

SET YOUR USER PASSWORD HERE

sudo passwd frappe
password: frappe07
sudo usermod -aG sudo frappe
sudo su - frappe

:small_blue_diamond: NODE JS & NPM

**

13.x

sudo apt-get install curl
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs

**

14.x

sudo apt-get install curl
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs

:small_blue_diamond: BENCH REPO

sudo pip3 install frappe-bench
sudo npm install -g yarn

:small_blue_diamond: FRAPPE

**

13.x

bench init frappe --verbose --frappe-branch v13.39.1 —{{{ replace with latest version }}}
cd frappe
bench start

**

14.x

bench init frappe --verbose
cd frappe
bench start

===========================================

- - OPEN NEW SESSION

==========================================
:small_blue_diamond: SITE CREATION

sudo su - frappe

cd frappe
bench new-site site1.local
bench use site1.local

:small_blue_diamond: ERPNEXT 13

bench get-app payments

make sure bench is runing in other terminal

bench get-app erpnext --branch v13.36.5 —{{{ replace with latest version }}}

make sure bench is runing in other terminal

bench get-app chat

make sure bench is runing in other terminal

bench get-app https://github.com/libracore/woocommerceconnector.git

make sure bench is runing in other terminal

bench --site site1.local install-app erpnext
make sure bench is runing in other terminal

bench --site site1.local install-app chat
make sure bench is runing in other terminal

bench --site site1.local install-app woocommerceconnector
make sure bench is runing in other terminal

bench use site1.local
bench migrate
STOP THE BENCH ( ctrl +c ) & START AGAIN ( bench start )

:small_blue_diamond: ERPNEXT 14

bench get-app payments

make sure bench is runing in other terminal

bench get-app erpnext

make sure bench is runing in other terminal

bench get-app hrms

make sure bench is runing in other terminal

bench get-app chat

make sure bench is runing in other terminal

bench get-app https://github.com/libracore/woocommerceconnector.git

make sure bench is runing in other terminal

bench --site site1.local install-app erpnext
make sure bench is runing in other terminal

bench --site site1.local install-app hrms
make sure bench is runing in other terminal

bench --site site1.local install-app chat
make sure bench is runing in other terminal

bench --site site1.local install-app woocommerceconnector
make sure bench is runing in other terminal

bench use site1.local
bench migrate
STOP THE BENCH ( ctrl +c ) & START AGAIN ( bench start )

.
.
.

:partying_face: GO TO [SERVER IP]:8000 SETUP YOUR DEVELOPMENT SYSTEM :partying_face:

=====================================================
.
.
.

:anger: PRODUCTION SETUP

bench --site site1.local enable-scheduler
bench --site site1.local add-to-hosts
bench --site site1.local set-maintenance-mode off
bench --site site1.local scheduler resume
sudo apt-get install snapd -y
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
sudo bench setup production frappe

bench setup supervisor
sudo ln -s pwd/config/supervisor.conf /etc/supervisor/conf.d/frappe-bench.conf

sudo bench setup sudoers $(whoami)

sudo su - frappe
cd frappe

sudo service supervisor stop
sudo service nginx stop
sudo service supervisor start
sudo service nginx start
sudo bench setup production frappe

.
.
.

:partying_face: GO TO [SERVER IP] YOUR PRODUCTION SYSTEM IS UP :partying_face:

.
.
.

================

:boom: NOTES :boom:

error: <class ‘PermissionError’>, [Errno 13] Permission denied: file: /usr/lib/python3/dist-packages/supervisor/xmlrpc.py line: 560

After productions is up. if you want to add any other app. just go through with below setup to avoid

============================

sudo su - frappe
cd frappe
sudo service supervisor stop
sudo service nginx stop
bench start

OPEN NEW SESSION

sudo su - frappe
cd frappe

bench get-app healthcare
make sure bench is runing in other terminal

bench get-app hospitality
make sure bench is runing in other terminal

bench --site site1.local install-app healthcare
make sure bench is runing in other terminal

bench --site site1.local install-app hospitality
make sure bench is runing in other terminal

bench use site1.local
bench migrate
sudo service supervisor start
sudo service nginx start
bench --site site1.local clear-website-cache

.
.

================

:boom: BENCH UPDATE :boom:

After productions is up. Update the Bench

===========================================

sudo su - frappe
cd frappe
sudo service supervisor stop
sudo service nginx stop
bench start

OPEN NEW SESSION

sudo su - frappe
cd frappe
bench update --reset
sudo service supervisor start
sudo service nginx start
bench --site site1.local clear-website-cache

2 Likes