ERPNext installation issues Ubuntu 20.04

Hello everybody!

I’ve been pulling my hair out for three days in a row, with Erpnext installation.

Tried docker installation, in vain.
Tried manual installation, in vain.
Tried virtual appliance production image, but networking of that appliance doesn’t work on XenServer (XCP-NG), I’ve had to manually enter the /etc/hostname data, /etc/hosts,
and assign port to be used as ethernet port, just to get an IP address After that most of the modules on NextErp didn’t work, for some reason.

I tried on:
 Centos 7,
 Ubuntu 18.04,
 Ubuntu Server 20.04,
 Ubuntu 20.04,
 Over 20 fresh installs of operating systems and trial and errors.
There are many tutorials on web how to install Erpnext, but most of them are outdated.

Some of them because of used version of python (2.7 won’t work with erpnext, also 3.6.9 won’t work, because of the ipython~=7.31.1 error, you need 3.8+ version of python).
I already had and corrected errors like strange yarn errors, general_ci to unicode_ci collation change, various permission issues…

Most success was made on Ubuntu 20.04, using this tutorial: How To Install ERPNext on Ubuntu 20.04 | RoseHosting
The breaking point was this command: sudo /home/erpnext/.local/bin/bench setup production erpnext

Log:
Summary

erpnext@erp:~$ sudo /home/erpnext/.local/bin/bench setup production erpnext
[sudo] password for erpnext:
Setting Up prerequisites…
Setting Up supervisor…
Update your /etc/supervisor/supervisord.conf with the following values:
[unix_http_server]
chmod=0760
chown=erpnext:erpnext
ERROR: [Errno 2] No such file or directory: ‘./config/supervisor.conf’
Traceback (most recent call last):
File “/home/erpnext/.local/bin/bench”, line 11, in
load_entry_point(‘frappe-bench’, ‘console_scripts’, ‘bench’)()
File “/usr/local/lib/python3.8/dist-packages/bench/cli.py”, line 121, in cli
raise e
File “/usr/local/lib/python3.8/dist-packages/bench/cli.py”, line 111, in cli
bench_command()
File “/usr/lib/python3/dist-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/usr/lib/python3/dist-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/usr/lib/python3/dist-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/lib/python3/dist-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/lib/python3/dist-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/lib/python3/dist-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/usr/local/lib/python3.8/dist-packages/bench/commands/setup.py”, line 72, in setup_production
setup_production(user=user, yes=yes)
File “/usr/local/lib/python3.8/dist-packages/bench/config/production_setup.py”, line 46, in setup_production
generate_supervisor_config(bench_path=bench_path, user=user, yes=yes)
File “/usr/local/lib/python3.8/dist-packages/bench/config/supervisor.py”, line 54, in generate_supervisor_config
with open(conf_path, ‘w’) as f:
FileNotFoundError: [Errno 2] No such file or directory: ‘./config/supervisor.conf’

  • After copying supervisor.conf file, new error occured:
Summary

erpnext@erp:~/.local/bin$ sudo /home/erpnext/.local/bin/bench setup production erpnext
Setting Up prerequisites…
Setting Up supervisor…
Update your /etc/supervisor/supervisord.conf with the following values:
[unix_http_server]
chmod=0760
chown=erpnext:erpnext
supervisor.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
ERROR: [Errno 2] No such file or directory: ‘./sites/common_site_config.json’
Traceback (most recent call last):
File “/home/erpnext/.local/bin/bench”, line 11, in
load_entry_point(‘frappe-bench’, ‘console_scripts’, ‘bench’)()
File “/usr/local/lib/python3.8/dist-packages/bench/cli.py”, line 121, in cli
raise e
File “/usr/local/lib/python3.8/dist-packages/bench/cli.py”, line 111, in cli
bench_command()
File “/usr/lib/python3/dist-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/usr/lib/python3/dist-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/usr/lib/python3/dist-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/lib/python3/dist-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/lib/python3/dist-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/lib/python3/dist-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/usr/local/lib/python3.8/dist-packages/bench/commands/setup.py”, line 72, in setup_production
setup_production(user=user, yes=yes)
File “/usr/local/lib/python3.8/dist-packages/bench/config/production_setup.py”, line 46, in setup_production
generate_supervisor_config(bench_path=bench_path, user=user, yes=yes)
File “/usr/local/lib/python3.8/dist-packages/bench/config/supervisor.py”, line 57, in generate_supervisor_config
update_config({‘restart_supervisor_on_update’: True}, bench_path=bench_path)
File “/usr/local/lib/python3.8/dist-packages/bench/config/common_site_config.py”, line 47, in update_config
put_config(config, bench_path=bench_path)
File “/usr/local/lib/python3.8/dist-packages/bench/config/common_site_config.py”, line 41, in put_config
with open(config_path, ‘w’) as f:
FileNotFoundError: [Errno 2] No such file or directory: ‘./sites/common_site_config.json’

There are many updates on NEXTErp, which is good, I’m glad to see that community is growing.

But, that updates require different dependencies from tutorials available online, so there is no relevant guide when it comes to the installation.
Can anyone give me a hand to install the ERPNext on Ubuntu 20.04 ?
And yes, I’ve tried running bench setup production without using su or root privileges.

1 Like

OK, now, I’ve followed installation guide from ↓

Now it’s stuck on “Rebuilding login.css”

OK, apparently, again, the installation steps were mixed up.
This error occurred because of the bench was started as dev version ??
After the: sudo bench setup production user ↓

I hit y

Next command, by following the tutorial, was: bench new-site dcode.com
That rendered this error:

Let’s set-up that character_set and collation_server! (again).

Error, again!

Summary

ERROR:
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 8, in
sys.exit(cli())
File “/usr/local/lib/python3.8/dist-packages/bench/cli.py”, line 121, in cli
raise e
File “/usr/local/lib/python3.8/dist-packages/bench/cli.py”, line 111, in cli
bench_command()
File “/usr/lib/python3/dist-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/usr/lib/python3/dist-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/usr/lib/python3/dist-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/lib/python3/dist-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/lib/python3/dist-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/usr/local/lib/python3.8/dist-packages/bench/commands/make.py”, line 142, in get_app
get_app(
File “/usr/local/lib/python3.8/dist-packages/bench/app.py”, line 371, in get_app
app.install(verbose=verbose, skip_assets=skip_assets, restart_bench=restart_bench)
File “/usr/local/lib/python3.8/dist-packages/bench/utils/render.py”, line 110, in wrapper_fn
return fn(*args, **kwargs)
File “/usr/local/lib/python3.8/dist-packages/bench/app.py”, line 198, in install
install_app(
File “/usr/local/lib/python3.8/dist-packages/bench/app.py”, line 436, in install_app
bench.reload()
File “/usr/local/lib/python3.8/dist-packages/bench/utils/render.py”, line 110, in wrapper_fn
return fn(*args, **kwargs)
File “/usr/local/lib/python3.8/dist-packages/bench/bench.py”, line 142, in reload
restart_supervisor_processes(bench_path=self.name, web_workers=web)
File “/usr/local/lib/python3.8/dist-packages/bench/utils/bench.py”, line 280, in restart_supervisor_processes
bench.run(f"{sudo}supervisorctl restart {group}")
File “/usr/local/lib/python3.8/dist-packages/bench/bench.py”, line 43, in run
return exec_cmd(cmd, cwd=cwd or self.cwd)
File “/usr/local/lib/python3.8/dist-packages/bench/utils/init.py”, line 126, in exec_cmd
raise CommandFailedError
bench.exceptions.CommandFailedError

I’ve removed site (bench drop-site …)
tried again, just errors and errrors.

Can someone help me out here, why I get errors, I followed the tutorial: ERPNext-installation-Guide The complete guide to install ERPNext in your Ubuntu system
Still, I don’t have ERPNext running in production.

Have you created a currentsite.txt file with your site name?

That what I kept missing when I first started installing ERPNext.

1 Like

Thank you for reply, I’ll try with that, after I do a new Ubuntu install.
Things get messy when bench starts to spit random errors, so, new OS, ahoy.

dCodE has the best guide. So you came to right place.

Just follow the steps exactly and it will work.

I recommend a development bench to start with as it is easier to troubleshoot configuration problems.

Regarding the MariaDB encoding, be sure to restart MariaDB after the configuration changes.

The currentsite.txt file is important to tell bench which site to serve.

dCodE’s guide is this one: ERPNext-installation-Guide The complete guide to install ERPNext in your Ubuntu system ?
If I start development bench, can I easily switch to production?
I’ve been able to start dev bench following the tutorial from first post, but not the production one.
Yes, I’ve restarted the MariaDB after editing the /etc/mysql/my.cnf

Yes ofcourse you can switch to production easily. However, bare in mind it is less straightforward to switch back to development from production - as far as I know.

1 Like

So after the

bench --site dcode.com install-app erpnext

(in step 15 on: GitHub - D-codE-Hub/ERPNext-installation-Guide: The complete guide to install ERPNext in your Ubuntu system )

I’ve done:
cd [bench directory]/sites/

sudo touch currentsite.txt
sudo nano currentsite.txt
and enter just your site name for example: site1.local
ctrl+s and ctrl-x

Then
bench --site [sitename] set-config maintenance_mode 0
bench start

Login screen: ↓

Summary

So, for production version I need to follow STEP 16 and, as it says, “Follow the steps from Step 12 to Step 15”, again?
Can I use the same site name as for the dev bench, or can I “transform” the existing dev to the production?

If you really get stuck, wipe the server and start over with Debian v10 (buster)

Then try this set of instructions:

I am still using this myself.

As always… Your Mileage May Vary! :sunglasses:

BKM

1 Like

Production bench, error, after the bench restart:

Summary

dcode-frappe@erp:~/frappe-bench$ sudo bench restart
$ supervisorctl restart frappe:
frappe: ERROR (no such group)
frappe: ERROR (no such group)
ERROR:
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 8, in
sys.exit(cli())
File “/usr/local/lib/python3.8/dist-packages/bench/cli.py”, line 121, in cli
raise e
File “/usr/local/lib/python3.8/dist-packages/bench/cli.py”, line 111, in cli
bench_command()
File “/usr/lib/python3/dist-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/usr/lib/python3/dist-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/usr/lib/python3/dist-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/lib/python3/dist-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/lib/python3/dist-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/usr/local/lib/python3.8/dist-packages/bench/commands/utils.py”, line 29 , in restart
Bench(“.”).reload(web, supervisor, systemd)
File “/usr/local/lib/python3.8/dist-packages/bench/utils/render.py”, line 110, in wrapper_fn
return fn(*args, **kwargs)
File “/usr/local/lib/python3.8/dist-packages/bench/bench.py”, line 142, in rel oad
restart_supervisor_processes(bench_path=self.name, web_workers=web)
File “/usr/local/lib/python3.8/dist-packages/bench/utils/bench.py”, line 280, in restart_supervisor_processes
bench.run(f"{sudo}supervisorctl restart {group}")
File “/usr/local/lib/python3.8/dist-packages/bench/bench.py”, line 43, in run
return exec_cmd(cmd, cwd=cwd or self.cwd)
File “/usr/local/lib/python3.8/dist-packages/bench/utils/init.py”, line 12 6, in exec_cmd
raise CommandFailedError
bench.exceptions.CommandFailedError

On port 80:

After restart of Ubuntu virtual machine, and after bench start, ERPNext faced this issue:


After more than 12 hours straight dealing with installation, my mind is unable to process this user permission issue.
If someone can help, don’t hesitate, surely I’d be grateful.

Which username did you use to setup production?

bench restart is supposed to be run without sudo using the same user you have configured for production.

If you configured frappe as a user for production, you to have to switch to that user before running any bench commands.

To switch to frappe user run the following command:

su - frappe

For experimental production setup I recommend the same user you normally use.

1 Like

bench start is only used for a development bench.

Use this command to check the status of a production bench

sudo supervisorctl status

To restart the bench

bench restart

You do not need to convert existing sites to production, just enabling bench production will allow it to serve the sites directly.

Easy Install Script still works. Why don’t you try that?

Currently I get few problems with easy install script which I mention here. I also mention workarounds.

https://github.com/frappe/bench/issues/1290

1 Like

Thank you, very much!
I’ve managed to install ERPNext on (currently) latest Debian 11.
Hints for installing ERPNext on Debian 11:

  • before this part (first step) →

Just type: su
hit enter and and enter the pass for root, as Debian 11 locks-out root access via SSH by default and if your user acc is not in sudoers or wheel group.
If any command you enter is not recognized, use sudo.

Hello I’m using the easy install but getting this error, any help. I’m running sudo python3 install.py --production with Frappe user with sudo priviledges
Traceback (most recent call last):
File “/root/install.py”, line 497, in
install_bench(args)
File “/root/install.py”, line 278, in install_bench
run_playbook(‘site.yml’, sudo=True, extra_vars=extra_vars)
File “/root/install.py”, line 413, in run_playbook
success = subprocess.check_call(args, cwd=playbooks_folder, stdout=log_stream, stderr=sys.stderr)
File “/usr/lib/python3.9/subprocess.py”, line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘ansible-playbook’, ‘-c’, ‘local’, ‘site.yml’, ‘-vvvv’, ‘-e’, ‘@/tmp/extra_vars.json’, ‘–become’, ‘–become-user=frappe’]’ returned non-zero exit status 2