Getting error while running "sudo bench setup lets-encrypt [site-name]"

I was trying to setup nginx for my erpnext installation

  1. when i try ipaddress in web browser it showing nginx page. It leads to erpnext webpage only with port 8000. i want to use only ipaddress for erpnext.
  2. This command sudo bench setup lets-encrypt [site-name] is not working showing error like “sudo: bench: command not found”

Please help me to solve this

In order for the command to work you need to be in the frappe-bench directory before you execute the command. I have also found that how you structure the command depends on how you installed the system you are using:

  • If you used the bench setup add-domain command to add the fully qualified domain name to your site then you will need to use this command to all a lets encrypt cert:

sudo -H bench setup lets-encrypt site1.local --custom-domain []

The exception to this is if you are using Ubuntu 18.04 as a host, the you eliminate the ( -H ) from the command like this:

sudo bench setup lets-encrypt site1.local --custom-domain []

  • If you are trying to setup a lets encrypt cert for a second tenant of a dns multi-tenant configuration then the command should look like this:

sudo -H bench setup lets-encrypt []

Except of course if you are on a Ubuntu 18.04 host then you need to eliminate the ( -H ) again:

sudo bench setup lets-encrypt []

Anyway, this is my experience at least and as always - Your mileage may vary… :sunglasses:


@bkm [quote=“bkm, post:2, topic:52599”]
sudo -H bench setup lets-encrypt site1.local --custom-domain []

i tried to run this from frappe-bench folder but It is not working at all in my latest ERPNext implementation. It shows sudo: bench: command not found. I’ve tried run without sudo, but showing error superuser privileges required for this command

Help me to find a solution for this

1 Like

Is your server a KVM type VPS server or is it a pre-made virtual image you are running?

I have never heard of an instance where there is no valid bench command.


@bkm I’ve installed it in gcloud only. I was able run bench command with out sudo. That is how i’ve done erpnext implementation. But in this case it is asking for superuser previlage for running this command. if i run the command as root user, it shows bench command error. Why it is like that ? Any solution much appreciated as i am stuck with my work here.

try run :
$ sudo ln -s /usr/local/bin/bench /bin/bench
it should work :slight_smile:
it denpend on the location of bench in your device : so try:
$ wtich bench