Install Letsencrypt on Linux: Today i would like to show you the easiest and quickest way to install Letsencrypt on Linux. The process involve few steps and is really automated. The aim here is to use certbot bootstrap script by EFF to request for SSL certificate for your website from Let’s Encrypt.

Certbot is an easy-to-use client that fetches a certificate from Let’s Encrypt-an open certificate authority launched by the EFF, Mozilla, and others and deploys it to a web server.

Below are the steps to follow:

  1. Download certbot-auto script
wget -P /usr/local/bin

Make the script executable:

chmod a+x /usr/local/bin/certbot-auto

Before you can request for ssl certificate, open port 443 on firewall, This demonstration assumes you are running CentOS 7.x whose firewall system is firewalld. If you have other systems like Ubuntu or Debian, firewall system might be different.

firewall-cmd --add-service https --permanent
firewall-cmd --reload

Now request for ssl certificate:

certbot-auto certonly -d -d

As you make first request, the script will install required packages/dependencies and setup virtual environment.

Note that you need active dns A record for the domain specified. For, this can be a CNAME record.

Answer few questions on the prompt and in no a time you have your ssl certificate and private key. Default location for this is: /etc/letsencrypt/live

Renewing certs
certbot-auto  --renew

Automated renewal using –pre-hook and –post-hook

- For nginx
# /usr/local/bin/certbot-auto renew --pre-hook "service nginx stop" \
--post-hook "service nginx start"

- For apache
# /usr/local/bin/certbot-auto renew --pre-hook "systemctl stop apache2" \
--post-hook "systemctl start apache2"

To force manual renewal:

certbot renew --force-renewal

If you would like to use cron jobs, your crontab should have a line similar to one below:

15 3 * * * usr/local/bin/certbot-auto renew --pre-hook "service nginx stop" --post-hook "service nginx start"

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here