Remove LetsEncrypt Certbot in Order to Properly Re-Install Certbot
[SOLVED] Certbot –apache. The requested apache plugin does not appear to be installed.
Check the version (which would indicate something is installed, but possibly the installation command wasn't exactly correct to install the plugin that integrates best with apache).
$ certbot --version
Result
certbot 1.21.0
Try obtaining a certificate by running certbot.
user@svr1:~$ sudo certbot --apache
Result below. Here is the dreaded error message: The requested apache plugin does not appear to be installed.
Saving debug log to /var/log/letsencrypt/letsencrypt.log The requested apache plugin does not appear to be installed
It's time to do everything to uninstall and properly reinstall certbot.
Step 1 - Run this.
user@svr1:~$ sudo certbot delete
Result
Saving debug log to /var/log/letsencrypt/letsencrypt.log No existing certificates found. Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
Step 2 - Run a purge.
user@svr1:~$ sudo apt purge python-certbot-apache
Result. Notice the errors.
Reading package lists... Done Building dependency tree... Done Reading state information... Done E: Unable to locate package python-certbot-apache user@svr1:~$ sudo a2dissite 000-default-le-ssl.conf ERROR: Site 000-default-le-ssl does not exist!
Next. Run an Update for packages.
user@svr1:~$ sudo apt update
Result. Nothing new available.
Hit:1 http://us.archive.ubuntu.com/ubuntu jammy InRelease Get:2 http://us.archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB] Get:3 http://us.archive.ubuntu.com/ubuntu jammy-backports InRelease [108 kB] Get:4 http://us.archive.ubuntu.com/ubuntu jammy-security InRelease [110 kB] Get:5 http://us.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [724 kB] Get:6 http://us.archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages [418 kB] Get:7 http://us.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [932 kB] Fetched 2,410 kB in 1s (1,689 kB/s) Reading package lists... Done Building dependency tree... Done Reading state information... Done All packages are up to date.
Step 3. REMOVE CERTBOT
user@svr1:~$ sudo apt remove certbot
Results. Certbot (defective install) appears to have been removed, with further instructions to run 'autoremove' in order to remove some leftover package(s) (former dependencies) that are no longer required. See below.
Reading package lists... Done Building dependency tree... Done Reading state information... Done The following packages were automatically installed and are no longer required: python3-acme python3-certbot python3-configargparse python3-icu python3-josepy python3-parsedatetime python3-requests-toolbelt python3-rfc3339 python3-zope.component python3-zope.event python3-zope.hookable Use 'sudo apt autoremove' to remove them. The following packages will be REMOVED: certbot 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. After this operation, 63.5 kB disk space will be freed. Do you want to continue? [Y/n] Y (Reading database ... 83386 files and directories currently installed.) Removing certbot (1.21.0-1build1) ... Processing triggers for man-db (2.10.2-1) ...
So, as instructed, we run 'autoremove'
user@svr1:~$ sudo apt autoremove
Results
Reading package lists... Done Building dependency tree... Done Reading state information... Done The following packages will be REMOVED: python3-acme python3-certbot python3-configargparse python3-icu python3-josepy python3-parsedatetime python3-requests-toolbelt python3-rfc3339 python3-zope.component python3-zope.event python3-zope.hookable 0 upgraded, 0 newly installed, 11 to remove and 0 not upgraded. After this operation, 4,852 kB disk space will be freed. Do you want to continue? [Y/n] Y (Reading database ... 83375 files and directories currently installed.) Removing python3-certbot (1.21.0-1build1) ... Removing python3-acme (1.21.0-1ubuntu0.1) ... Removing python3-configargparse (1.5.3-1) ... Removing python3-icu (2.8.1-0ubuntu2) ... Removing python3-josepy (1.10.0-1) ... Removing python3-parsedatetime (2.6-2) ... Removing python3-requests-toolbelt (0.9.1-1) ... Removing python3-rfc3339 (1.1-3) ... Removing python3-zope.component (4.3.0-3) ... Removing python3-zope.event (4.4-3) ... Removing python3-zope.hookable (5.1.0-1build1) ...
That seemed to have worked well.
Let's do a restart of the apache2 webserver . . . just for good measure.
user@svr1:~$ sudo systemctl restart apache2 user@svr1:~$ sudo systemctl status apache2
Results. Everything Seems to be Running well. See below. Note: There was an old completely unrelated warning alert that is still in the apache status error log list that was previously fixed by optionally editing apache2.conf in order to insert a line for ServerName [and local/lan IP] under a [Global] section of the .conf file, thus setting the server's ip globally on the system. I probably could have merely inserted 'localhost' or '127.0.0.1' just as well. I found the apache2.conf file in the path /etc/apache2/apache2.conf.
● apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2023-06-22 14:43:31 UTC; 9s ago Docs: https://httpd.apache.org/docs/2.4/ Process: 9988 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS) Main PID: 9992 (apache2) Tasks: 6 (limit: 19013) Memory: 14.8M CPU: 55ms CGroup: /system.slice/apache2.service ├─9992 /usr/sbin/apache2 -k start ├─9993 /usr/sbin/apache2 -k start ├─9994 /usr/sbin/apache2 -k start ├─9995 /usr/sbin/apache2 -k start ├─9996 /usr/sbin/apache2 -k start └─9997 /usr/sbin/apache2 -k start Jun 22 14:43:31 svr1 systemd[1]: Starting The Apache HTTP Server... Jun 22 14:43:31 svr1 apachectl[9991]: AH00558: apache2: Could not reliably determine the server's full>Jun 22 14:43:31 svr1 systemd[1]: Started The Apache HTTP Server.
Now you can PROPERLY reinstall certbot that integrates with Apache2.
Go Here: Install LetsEncrypt Certbot Apache2 on Ubuntu Server 22.04