Erpnext 14 Installation DEVELOPMENT & PRODUCTIONS [UBUNTU/SERVER 22.04]

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

ERPNext 12 ubuntu 20

ERPNext 13 ubuntu 22

ERPNext DEV-14+ ubuntu 22

DEBIAN 11 ERPNext 13, 14+DEV
.

: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@server22

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 git python3-dev python3.10-dev python3-setuptools python3-pip python3-distutils redis-server -y
apt install python3.10-venv -y
sudo 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@server22

SET YOUR USER PASSWORD HERE

sudo passwd frappe
password: frappe07

sudo su - frappe
sudo chmod o+x $HOME
tee -a ~/.bashrc<<EOF
PATH=$PATH:~/.local/bin/
EOF
source ~/.bashrc

:small_blue_diamond: NODE JS & NPM

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 DIRECTORY

sudo mkdir /home/bench
sudo chown -R frappe /home/bench
cd /home/bench
sudo npm install -g yarn

:small_blue_diamond: FRAPPE

sudo pip3 install frappe-bench
bench init frappe --verbose --frappe-branch v14.0.0 —{{{ replace with latest version }}}
cd frappe
bench start

OPEN NEW SESSION

:small_blue_diamond: SITE CREATION

sudo su - frappe
cd /home/bench/frappe
bench new-site site1.local
bench use site1.local
bench migrate

:small_blue_diamond: ERPNEXT & HRMS

bench get-app payments

make sure bench is runing in other terminal

bench get-app erpnext --branch v14.0.0 —{{{ replace with latest version }}}

make sure bench is runing in other terminal

bench get-app hrms

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
bench use site1.local
bench migrate
make sure bench is runing in other terminal

.
.
.

: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 snap install --classic 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)

STOP BENCH ++> ctrl+c

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 /home/bench/frappe
sudo service supervisor stop
sudo service nginx stop
bench start

OPEN NEW SESSION

sudo su - frappe
cd /home/bench/frappe

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 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 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 --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 /home/bench/frappe
sudo service supervisor stop
sudo service nginx stop
bench start

OPEN NEW SESSION

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

16 Likes

Thank you so much!!!

After whole days trying, this worked on the first attempt!!!

Please note the single quotation marks in the password parenthesis appear to be the wrong kind.

Once again, thank you so much!!

2 Likes

Once again, and I won’t get tired of saying it, thank you @Usman_Ali !!

Sorry for being ambiguous in my earlier comment, I meant to say -'- instead of -‘- but I’m not 100% sure :man_shrugging:

I went through so many guides, none worked. Yours did. :pray:Highly appreciated!

You would not happen to have at hand a guide to install an SSL certificate for local installations manually? (no automatic let’s encrypt/certbot) :grin:

:scream: :scream: it’s the forum, it replaces the quotation marks!!

This is what I wrote:
image

This is what it shows:
image

Straight instead of curly. Does it matter? Do we need to notify someone to avoid confusions?

edit: to avoid confusions system wide, I mean, not only in this post (again, in case it matters)

Not the passwords, but the quotes being changed by this platform, like in the images I posted above.

Quote marks appear being changed from straight to curly quote marks.

It’s the style of single quote marks the risk for confusion, straight style being changed to curly style by the forum platform. But I’m not sure if it matters to report it or not?

@Usman_Ali I have some questions to clarify things, if you may:

  1. Can ERPNext be installed on Ubuntu desktop version?
  2. Can it work without internet access?

should be work in desktop. coz all requirements will be install on setup.
for installation u need internet connection. after Production up. as i know. after installation. should be no need of internet. but never try.

for internet. please any one can help?

Hi @Usman_Ali I think giving execution permission on the entire /home directory is a serious security issue.

I would suggest that instead of installing bench in /home/bench/, it is better to install it in the frappe user’s home directory i.e. /home/[frappe-user]/bench/

This way the entire /home directory is not exposed.

Hi @Usman_Ali , would you say line 1 here should be

Switch to unix_socket authentication [Y/n]?

image

Yes i forget. You can go through with yes or not. I tried both. It always works

Thank you!

1 Like

Please help us with SSL configuration instructions for local installation something like localerp.mydomain.com :pray:

Dear @Usman_Ali

I have used the same way that you used, but with every get-app I have got the same error.

$ supervisorctl restart frappe:
error: <class 'PermissionError'>, [Errno 13] Permission denied: file: /usr/lib/python3/dist-packages/supervisor/xmlrpc.py line: 560
ERROR:
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 8, in <module>
    sys.exit(cli())
  File "/home/frappe/.local/lib/python3.10/site-packages/bench/cli.py", line 127, in cli
    bench_command()
  File "/home/frappe/.local/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/.local/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/frappe/.local/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/.local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/.local/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/frappe/.local/lib/python3.10/site-packages/bench/commands/make.py", line 159, in get_app
    get_app(
  File "/home/frappe/.local/lib/python3.10/site-packages/bench/app.py", line 432, in get_app
    app.install(verbose=verbose, skip_assets=skip_assets, restart_bench=restart_bench)
  File "/home/frappe/.local/lib/python3.10/site-packages/bench/utils/render.py", line 126, in wrapper_fn
    return fn(*args, **kwargs)
  File "/home/frappe/.local/lib/python3.10/site-packages/bench/app.py", line 230, in install
    install_app(
  File "/home/frappe/.local/lib/python3.10/site-packages/bench/app.py", line 577, in install_app
    bench.reload()
  File "/home/frappe/.local/lib/python3.10/site-packages/bench/utils/render.py", line 126, in wrapper_fn
    return fn(*args, **kwargs)
  File "/home/frappe/.local/lib/python3.10/site-packages/bench/bench.py", line 150, in reload
    restart_supervisor_processes(bench_path=self.name, web_workers=web)
  File "/home/frappe/.local/lib/python3.10/site-packages/bench/utils/bench.py", line 304, in restart_supervisor_processes
    bench.run(f"{sudo}supervisorctl restart {group}")
  File "/home/frappe/.local/lib/python3.10/site-packages/bench/bench.py", line 47, in run
    return exec_cmd(cmd, cwd=cwd or self.cwd)
  File "/home/frappe/.local/lib/python3.10/site-packages/bench/utils/__init__.py", line 155, in exec_cmd
    raise CommandFailedError
bench.exceptions.CommandFailedError

Even when I do bench restart I got the same error.

1 Like

After productions is up. if you want to add any other app. just go through with below setup to avoid
error: <class ‘PermissionError’>, [Errno 13] Permission denied: file: /usr/lib/python3/dist-packages/supervisor/xmlrpc.py line: 560

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

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

OPEN NEW SESSION

sudo su - frappe
cd /home/bench/frappe

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 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 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 --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

THANKS A LOT FOR THE POST.
IT WAS WORKING FINE BUT AFTER RESTART OF THE SERVER I AM GETTING THIS ERROR:

how many users are there. should be only 2 users. root and {Your User}
run again production command with exact second user. should be ok all

actually 3 user there root, frappe and ubuntu. it is on oracle cloud and we should not remove user ‘ubuntu’.
I run production command on ‘frappe’ user again but facing same problem.