Try ERPNext Buy Support Partners Foundation

Installation on CentOS 8 from instruction not working

Completely followed this instruction: https://github.com/software-to-hardware/erpnext-vat-mtd/blob/master/doc/erpnext_centos8.md

Everything ok untill:

bench setup supervisor
bench setup nginx

There are more posts about this: ound-while-setup-supervisor/62028/8

edit: Sudo: bench command not found while setup Supervisor

Exact the same here. Nothing is working to start these commands.

Any help would be appreciated. Until now no success installing ERPNext on Centos 7, Centos 8 or Ubuntu.

1 Like

Ya… it has been 3 days I tried to install in CentOS 8.
Always stuck to that WARN: superuser privileges required for this command

The problem is when setting up production according to that guide.

The alternative using install.py script always stuck with exit status 2 (Ubuntu 18, CentOS 7 and 8).

I’ve tried maybe everything looks promising solution in the discuss but nothing goes further.

1 Like

And no one has a solution for this?

I tried to install the software on CentOS7, CentOS8 and Ubuntu20.04 but all three without success.

I have installed alot of different software in my life, but never had such hard time getting a piece of software to work.

Installing as development has no problem.
But to then set as production is the problem.

Few weeks ago I have tried to install on Centos 8 following that guide.

I ran into trouble with sudo too.

I noticed that installing bench pip package locally it didn’t work.

  1. I installed bench system wide sudo pip3 install bench. It let you notice that is not a good practice install pip package without --user and becoming root, but for a test, I didn’t care.

  2. sudo visudo I added /usr/local/bin to secure path

  3. Be careful that in some distro supervisor use *.conf and other use *.ini so symlinks can point to the wrong path/extension

  4. Instead using bench setup supervisor and bench setup Nginx, try, straight to the point, bench setup production

The guide you followed, needs a bit of “fix” on the installation process, but if you dig into bench playbooks and scripts you will learn quite a lot :wink:

1 Like

But isn’t the first problem is if doing sudo pip3 install then bench is not found?
So how to do bench setup production?
Does the #2 and #3 step to fix this?

Installing bench with sudo will put all executable in /usr/local/bin folder instead of your home folder

bench is not found because it isn’t among sudo secure path

Adding /usr/local/bin path to sudo secure_path it allows you to do sudo bench whatever xyz

have a read: https://www.tecmint.com/sudoers-configurations-for-setting-sudo-in-linux/

So how to do bench setup production ?
Does the #2 and #3 step to fix this?

Looking into bench repository on GitHub you can understand easily what bench setup production does:
https://github.com/frappe/bench/blob/develop/bench/config/production_setup.py

Hope this can help you to find the “right path” for the solution

fromthestone, thanks for your help so far.

I added the path /usr/local/bin to the secure path:

But still sudo bench gives: command not found

The place where I find bench is under /home/erp/.local/bin/

When I add this to the path I get this error:

Traceback (most recent call last):
File “/home/erp/.local/bin/bench”, line 7, in
from bench.cli import cli
ModuleNotFoundError: No module named ‘bench’

But where is your bench installation?
in your home folder? -> you did pip3 install with or without --user flag?

bench systemwide -> sudo pip3 install bench -> /usr/local/bin
bench on your folder -> pip3 install --user bench (no sudo) -> $HOME/.local/bin/bench

If you installed bench locally, it should be $HOME/.local/bin/bench -> do which bench to discover it (without sudo)

And add to right path of bench to secure_path

try to logout and login again after visudo modifications.

More, did you check permission and ownership are fine? 755 and erp:erp?

Try also pip3 install --update --force-reinstall --user bench and let’s see if fixing your bench installation

The bench installation is in the folder of the erp user (same as in the instruction).

When I do sudo pip3 install bench I get a succesful installation but still running bench with sudo is not working. There is nothing in /usr/local/bin related to bench.

pip3 install --update --force-reinstall --user bench is not working because --update is not a valid option.

  1. running bench setup production or supervisor or nginx should be with sudo too.

  2. I found this because production.py only specify
    supervisor_conf_extn = "ini" if is_centos7() else "conf" (not specifying centos 8?)
    and get_supervisord() in supervisor only search for *.conf
    so even after renaming supervisor.conf (in frappe-bench/config folder) to supervisor.ini and running bench setup supervisor again will recreate the supervisor.conf and the script keep calling it.

Keep getting this:

Failed to restart supervisor.service: Unit supervisor.service not found. sudo systemctl restart supervisor executed with exit code 5

Now… should we change the bench script?
or the symlink (and where to find it)?
or which file?

Following this guide (with a few tweak) I now can install ERPNext production on CentOS 8. By “can” I mean I can go through all the commands and get supervisor and nginx status to active.

But still I can’t access my site with site name.
Using IP or domain namen it shows the nginx default page.
Using site name (sub.domain.com) the browser says it can’t find the server.

On local dev site it is suggested to include host_name in site_config.json. Should it be done the same with production?

@rahy,

What tweaks did you make to get at least these steps working?

bench setup supervisor
bench setup nginx

I am still unable to complete these steps.

I am not really sure because I tried many times with many references.

  • But I think my main mistake is to use sudo when doing sudo pip3 install --user frappe-bench which should be `sudo pip3 install frappe-bench’

  • and then, if I remember correctly, I do chmod 755 /home/username before running setup supervisor and nginx.

  • I also use systemctl list-unit-files --type=service many times to check if the service is active or not.

  • also do a lot of ls -l and cd and which to check the directory mentioned in that guide (and in production.py) to see if they are in correct places.

  • also I think I did setup nginx first before setup supervisor.

  • One thing I’m still not able to do is to set the permission setsebool.

  • and I think I also chown -R username:username frappe-bench/*

I don’t know what happened. I do bench lets-encrypt and now it works. I can see my site :scream:

About this, it will be nice if you open an issue on Bench GitHub page
https://github.com/frappe/bench/issues

If I do $ which bench the result is /usr/local/bin/bench
but if I do $ bench src the result is /usr/local/lib/python3.6/site-packages

Which one is actually used?
Thanks

it depends by your $PATH variable and /usr/local/bin folder is the right one for this use
If you do an ls -l /usr/local/bin you will see that /usr/local/bin/bench probably it’s a symlink. (just for your reference, nothing change in order to let bench command working)

If you want to know more about use of symlinks and shell variables, it’s enough you understand shell basic topics

Start from here, but google can give you more info than what I know :wink:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.