Install Certbot SSL HTTPS Using Snap

Install Certbot SSL HTTPS Using Snap

Install snapd (if not already installed)

#sudo apt update
#sudo apt install snapd -y

Enable and start snap:

$sudo systemctl enable snapd
$sudo systemctl start snapd

Let the system link classic snaps:

$sudo snap install core
$sudo snap refresh core

Install Certbot via Snap

$sudo snap install --classic certbot

Create symlink so certbot works globally:

$sudo ln -s /snap/bin/certbot /usr/bin/certbot

Check Certbot version:

$sudo certbot --version
certbot 2.x.x

Obtain SSL certificate for Nginx, make sure your Nginx config for http is working at http://yourdomain.com, then run:

#certbot --nginx -d yourdomain.com -d www.yourdomain.com
Certbot will: Auto-detect your Nginx config
Request and install a certificate
Ask if you want HTTP to HTTPS redirect (say yes)

Test HTTPS: Open https://yourdomain.com and You should see the lock icon

Auto-renew is set up by Snap

You don’t need to manually configure cron jobs. Snap installs a systemd timer to auto-renew: Check it:

$sudo systemctl list-timers | grep certbot
✅ Done!

You now have:
Fresh Certbot installed via Snap
Nginx auto-configured for HTTPS
Auto-renewals enabled

Delete Certbot SSL Certificate and Domain

    • Show all certificate
$sudo certbot certificates
Found the following certs:
Certificate Name: mydomainname.com
Serial Number: 6810f862e51702da43e0e1bc2f80f0d1123
Key Type: ECDSA
    • Delete the  SSL Certificate that you want
$sudo delete --cert-name mydomainname.com
Are you sure you want to delete the above certificate(s)?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
Deleted all files relating to certificate mydomainname.com.