Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Automatically Renew Let's Encrypt SSL Certificates on Ubuntu 18.04 Apache Webserver

Related Posts

Steps

Install the certbot tool:

sudo apt-get install software-properties-common -y \
  && sudo add-apt-repository ppa:certbot/certbot -y \
  && sudo apt install python-certbot-apache

Request certificates for the first time with:

DOMAIN_1="domain.com"
DOMAIN_2="www.domain.com"
sudo certbot --apache -d $DOMAIN_1 -d $DOMAIN_2

If you just have one domain to renew, then specify just one -d, if you have 3, then specify 3 x -d parameters. You get the gist.

Automatically Renew

To configure certbot to automatically renew your certificates, edit your cronjobs with:

sudo crontab -e

Add a line to try and renew the certificates daily

@daily /usr/bin/certbot renew --quiet

References

Last updated: 25th April 2022
First published: 4th March 2020