Lamp: a2enmod command not found

I tried to install nextcloudpi, but faced an issue. Appreciate if anyone can help and give any advice.
What I have done:

  1. Installed Debian Buster without desktop environment.
  2. Ran curl installation : # curl -sSL | bash

Then I got error: lamp: a2enmod command not found.

PHP version is 7.3.

Do you have Apache installed?

Try installing apache2 first:
apt-get install apache2

Then re-run the curl installation

Hmm Apache should be installed by the script as well:
Perhaps something failed with this. Check the scripts output where this should have happened.

Otherwise maybe @nachoparker might be able to help.

Thanks for your advice. Apache2 is already installed. I tried rerun it, and reinstall it, but same outcome, still a2enmod not found.

Thanks for your advice. I tried using curl to run, still no success. I didn’t save the output.

Don’t run manually. It is called from within
However if with installed Apache2 a2enmod is still not available, then there is something broken on a deeper level. However no change to know further without having some output.

hash -r does not help?
echo $PATH contains the 6 usual locations?
command -v a2enmod has no output?
reboot does not help?

Thanks @Michalng, echo $PATH is the point, I saw /sbin was not in the PATH. Now the problem is solved.

How did you solved the problem?

I just did a Debian Buster minimal install and then run the script which exited with exactly the same error message.


Starting with Debian 10 buster the way how the su command is used has been changed. By default execution of the su command no longer provides you with expected user environmental variables.
In the case of a simple switch to administrative user root by executing su with no arguments the expected root’s PATH variable is no set properly.

So running the script with sudo will not work, switching to root with su will also not work!
To make this install script work, you have to login as root.

Could a check be added to the beginning of the install script to check if the user is logged in as proper root or set additional PATH variable?

that’s curious. I added the PATH to the curl installer.

Thanks for reporting

Hi, @as365n4, I saw the missing a2enmod was actually in /sbin, and I saw /sbin was not in PATH. So I manually added /sbin into PATH, then solved issue.