Ubuntu 20.04 & 18.04

Install Certbot package. Available standard repository.

Ubuntu 20.04
$ sudo apt install certbot python3-certbot-apache
Ubuntu 18.04
$ sudo apt install letsencrypt python-certbot-apache

Before execution ‘certbot’, rewrite apache module must be available.

# a2enmod rewrite

1st time recommended command is

Ubuntu 20.04

# certbot --apache

Ubuntu18.04

# certbot run --apache --dialog

This command is able to find non ssl web setting and auto update certificate and chain by reading /etc/apache2/sites-available directory. And also is fixes virtual host configuration files. And then restarting apache.

# systemctl restart apache2.service
Renewal certification file, certbot-auto command.
# certbot renew --post-hook "systemctl restart apache2.service"

also available cron daemon setting.

example file, letsencrypt  can be put on /etc/cron.monthly/ ,

#!/bin/sh

# update (renew) cert.
/usr/bin/certbot renew --post-hook "systemctl restart apache2.service"

Japanese “Let’s Encrypt” site is https://letsencrypt.jp/.