1. install snapd on Debian
$ sudo apt update $ sudo apt install snapd $ snap install core core 16-2.45.2 from Canonical✓ installed $sudo snap refresh core
2. Install the Certbot
sudo snap install --classic certbot
Install the Cert for nginx
sudo certbot --nginx
It will create a timer file with crontab /etc/cron.d/certbot
# /etc/cron.d/certbot: crontab entries for the certbot package # # Upstream recommends attempting renewal twice a day # # Eventually, this will be an opportunity to validate certificates # haven't been revoked, etc. Renewal will only occur if expiration # is within 30 days. # # Important Note! This cronjob will NOT be executed if you are # running systemd as your init system. If you are running systemd, # the cronjob.timer function takes precedence over this cronjob. For # more details, see the systemd.timer manpage, or use systemctl show # certbot.timer. SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 0 */12 * * * root test -x /usr/bin/certbot -a \! -d /run/systemd/system && perl -e 'sleep int(rand(43200))' && certbot -q renew
Verify it
systemctl list-timers
3. Install the Cert
sudo certbot –nginx
Then select the domain, and action:
Which names would you like to activate HTTPS for? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1: your.domain.name - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Select the appropriate numbers separated by commas and/or spaces, or leave input blank to select all options shown (Enter 'c' to cancel): 1 Cert not yet due for renewal You have an existing certificate that has exactly the same domains or certificate name you requested and isn't close to expiry. (ref: /etc/letsencrypt/renewal/your.domain.name.pem) What would you like to do? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1: Attempt to reinstall this existing certificate 2: Renew & replace the cert (limit ~5 per 7 days)
Select the 1. Then you will see below:
Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/your.domain.name/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/your.domain.name/privkey.pem Your cert will expire on 2021-01-24. To obtain a new or tweaked version of this certificate in the future, simply run certbot again with the "certonly" option. To non-interactively renew *all* of your certificates, run "certbot renew"