I've tried
sudo apt-get remove python-certbot-apache
sudo apt-get purge --auto-remove python-certbot-apache
sudo apt-get remove python3-certbot-apache
sudo apt-get purge --auto-remove python3-certbot-apachebut when I run command certbot it still is recognized. How can I completely remove it, thus, typing that command was like any unrecoginzed command.
4 Answers
Below steps worked for me when I needed the same solution.
Remove Certbot
sudo certbot deleteRemove Certbot's Apache package
sudo apt purge python-certbot-apacheDisable the SSL config file created by certbot
sudo a2dissite 000-default-le-ssl.confRemove certbot files manually
sudo rm -rf /etc/letsencrypt/ sudo rm -rf /var/lib/letsencrypt/ sudo rm -rf /var/log/letsencrypt/Make sure the repo is updated and autoremoved
sudo apt update sudo apt upgrade sudo apt autoremoveCautious: Additionally you can also reinstall apache2 if needed for fresh config files
sudo apt purge apache2 sudo service apache2 restart
If mods-available folder also completely get purged during apache2 removal process then PHP will not be executed and code will be displayed on the browser. In my case, PHP version is 7.2 and executed the below. Adjust the below commands based on your PHP version.
sudo apt purge libapache2-mod-php7.2 sudo apt install libapache2-mod-php7.2 sudo a2enmod php7.2 sudo apachectl configtest sudo service apache2 restartHope this helps someone.
If you have installed certbot using snap, this will work perfectly:
sudo snap remove certbot Do a search with:
sudo dpkg -l *certbot*-l *certbot* does a regex search, so packages with names that include "certbot" will be returned in the search results.
dpkg-query -l *certbot*will also do the same. From man dpkg:
dpkg-query actions See dpkg-query(1) for more information about the following actions. -l, --list package-name-pattern... List packages matching given pattern.Also see info dpkg!
I tried to use sudo apt install certbot on my Ubuntu.
And it turns out the version 0.40.0 is far behind the current version 1.16.
So I followed 5th step of the official instructions here.
Run sudo apt-get remove certbot and sudo apt autoremove. It works for me.