# Automatic renewal of Let's Encrypt Certificates

URL: https://brege.org/post/automatic-renewal-of-letsencrypt/
Published: 2016-10-11
Updated: 2026-04-12
Tags: lets-encrypt, certbot, systemd, https, certificate-renewal
Categories: software

Let's Encrypt certificates need to be renewed every three months.
[The Arch Wiki](https://wiki.archlinux.org/index.php/Let%E2%80%99s_Encrypt#Automatic_renewal) has good documentation on automating the renewal process with systemd.<!--more-->

* In `/etc/systemd/system/certbot.service`:

``` ini
[Unit]
Description=Let's Encrypt renewal

[Service]
Type=oneshot
ExecStart=/usr/bin/certbot renew --quiet --agree-tos
```

* In `/etc/systemd/system/certbot.timer`:

``` ini
[Unit]
Description=Daily renewal of Let's Encrypt's certificates

[Timer]
OnCalendar=daily
RandomizedDelaySec=1day
Persistent=true

[Install]
WantedBy=timers.target
```

* Enable and start the timer:

``` bash
sudo systemctl enable certbot.timer
sudo systemctl start certbot.timer
```