# mkdir -p /opt/{bin,certbot/bin} \
&& curl -sS \
-o /opt/certbot/bin/certbot-auto \
https://dl.eff.org/certbot-auto \
&& chmod 711 /opt/certbot/bin/certbot-auto \
&& ln -sf \
/opt/certbot/bin/certbot-auto \
/opt/bin/certbot-auto
# cat > /etc/profile.d/add-opt-bin-path.sh <<-EOT
#!/usr/bin/env bash
pathmunge /opt/bin
EOT
# source /etc/profile
# certbot-auto -nq
Note: Remove --test-cert
when ready to request from the live, (rate limited), service.
This method is useful if generating certificates on a server other than the target host.
# certbot-auto certonly \
--agree-tos \
--domains www.example.com,example.com \
--email [email protected] \
--manual \
--manual-public-ip-logging-ok \
--test-cert \
--text
This method is useful if needing to obtain certificates for a running public web server.
# certbot-auto certonly \
--agree-tos \
--domains www.example.com,example.com \
--email [email protected] \
--test-cert \
--text \
--webroot \
--webroot-path /var/www/example/public_html/
Either update the VirtualHost paths for SSLCertificateChainFile
, SSLCertificateKeyFile
and SSLCertificateFile
to /etc/letsencrypt/live/www.example.com/chain.pem
, /etc/letsencrypt/live/www.example.com/privkey.pem
and /etc/letsencrypt/live/www.example.com/fullchain.pem
directly or create symbolic links from the existing paths to the Let's Encrypt live certificate files.
The SSLCertificateChainFile
shouldn't be necessary when using the full chain in the SSLCertificateFile
but without this SSL fails after renewal with an error "This server’s certificate chain is incomplete".
# mkdir -p \
/var/www/ssl/www.example.com \
&& ln -sf \
/etc/letsencrypt/live/www.example.com/chain.pem \
/var/www/ssl/www.example.com/chain.pem \
&& ln -sf \
/etc/letsencrypt/live/www.example.com/privkey.pem \
/var/www/ssl/www.example.com/privkey.pem \
&& ln -sf \
/etc/letsencrypt/live/www.example.com/fullchain.pem \
/var/www/ssl/www.example.com/fullchain.pem
# apachectl graceful
The renew sub-command can be run periodically, (twice a day is recommended), via cron
or a systemd
timer.
# certbot-auto renew \
--quiet \
--no-self-upgrade \
--post-hook "apachectl graceful"
The following example will run the renew sub-command at 05:27 and 21:27 daily.
27 5,21 * * * /opt/bin/certbot-auto renew --quiet --no-self-upgrade --post-hook "apachectl graceful" >> /var/log/certbot.log 2>&1