How to completely remove "certbot" from ubuntu?
Solution 1:
Below steps worked for me when I needed the same solution.
-
Remove Certbot
sudo certbot delete
-
Remove Certbot's Apache package
sudo apt purge python-certbot-apache
-
Disable the SSL config file created by certbot
sudo a2dissite 000-default-le-ssl.conf
-
Remove 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 autoremove
-
Cautious: 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 restart
Hope this helps someone.
Solution 2:
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
!
Solution 3:
If you have installed certbot
using snap
, this will work perfectly:
sudo snap remove certbot
Solution 4:
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.