Cant install cert on Ubuntu 16.04 with custom built Apache

Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. https://crt.sh/?q=example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is: jonathandentportraits.co.uk

I ran this command: certbot certonly -v --apache -d jonathandentportraits.co.uk -d www.jonathandentportraits.co.uk --apache-ctl /usr/sbin/apachectl --apache-server-root /usr/local/apache2

It produced this output:

Root logging level set at 10
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Requested authenticator apache and installer apache
Other error:(PluginEntryPoint#apache): Unable to find Apache version
Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/certbot/plugins/disco.py”, line 132, in prepare
self._initialized.prepare()
File “/usr/lib/python3/dist-packages/certbot_apache/configurator.py”, line 239, in prepare
self.version = self.get_version()
File “/usr/lib/python3/dist-packages/certbot_apache/configurator.py”, line 2238, in get_version
raise errors.PluginError(“Unable to find Apache version”)
certbot.errors.PluginError: Unable to find Apache version
No candidate plugin
No candidate plugin
Selected authenticator None and installer None
Could not choose appropriate plugin: The apache plugin is not working; there may be problems with your existing configuration.
The error was: PluginError(‘Unable to find Apache version’,)
Exiting abnormally:
Traceback (most recent call last):
File “/usr/bin/certbot”, line 11, in
load_entry_point(‘certbot==0.31.0’, ‘console_scripts’, ‘certbot’)()
File “/usr/lib/python3/dist-packages/certbot/main.py”, line 1365, in main
return config.func(config, plugins)
File “/usr/lib/python3/dist-packages/certbot/main.py”, line 1229, in certonly
installer, auth = plug_sel.choose_configurator_plugins(config, plugins, “certonly”)
File “/usr/lib/python3/dist-packages/certbot/plugins/selection.py”, line 237, in choose_configurator_plugins
diagnose_configurator_problem(“authenticator”, req_auth, plugins)
File “/usr/lib/python3/dist-packages/certbot/plugins/selection.py”, line 341, in diagnose_configurator_problem
raise errors.PluginSelectionError(msg)
certbot.errors.PluginSelectionError: The apache plugin is not working; there may be problems with your existing configuration.
The error was: PluginError(‘Unable to find Apache version’,)
The apache plugin is not working; there may be problems with your existing configuration.
The error was: PluginError(‘Unable to find Apache version’,)

My web server is (include version):
Server version: Apache/2.4.25 (Unix)

The operating system my web server runs on is (include version):
Ubuntu 16.04

My hosting provider, if applicable, is:
N/A

I can login to a root shell on my machine (yes or no, or I don’t know):
Yes

I’m using a control panel to manage my site (no, or provide the name and version of the control panel):
No

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you’re using Certbot):
certbot 0.31.0

You might want to try the --webroot -w /path/to/web/root/ option.
[instead of using the --apache installer]