Welcome to Praful Bhuskute BlackSpy Praful Bhuskute BlackSpy Praful Bhuskute BlackSpy Praful Bhuskute BlackSpy

How to Install Let’s Encrypt Free SSL (Certbot) on Ubuntu with Automatically Renew

How to Install Let’s Encrypt Free SSL (Certbot) on Ubuntu with Automatically Renew

Let’s Encrypt offers complimentary SSL certificates for securing your websites with encrypted connections. Certbot, an open-source tool, enables the straightforward generation of Let’s Encrypt SSL certificates on your self-managed Linux server at no cost.

Now you need to log in to your server using SSH (Currently I am using AWS EC2 Medium Server)

Install Certbot in Ubuntu with snapd

Step 1: Install snapd

				
					sudo apt install snapd
				
			

Step 2: Ensure you have the latest snapd version installed

				
					sudo snap install core; sudo snap refresh core
				
			

Step 3: Install Certbot with snapd

				
					sudo snap install --classic certbot
				
			

Step 4: Create a symlink to ensure Certbot runs

				
					sudo ln -s /snap/bin/certbot /usr/bin/certbot
				
			

Create an SSL Certificate with Certbot

Execute Certbot to generate SSL certificates and update your web server configuration file for automatic redirection of HTTP requests to HTTPS. Alternatively, include “certonly” to create SSL certificates without altering system files.

Step 1: Create SSL certs for all Domains and configure redirects in the Web Server

Create SSL certs for all domains and configure redirects in the Nginx Web Server

				
					sudo certbot --nginx
				
			

Create SSL certs for all domains and configure redirects in the Apache Web Server

				
					sudo certbot --apache
				
			

Create SSL certs for a specified domain that you hosted on Nginx Web Server

				
					sudo certbot --nginx -d example.com -d www.example.com
				
			

Create SSL certs for a specified domain that you hosted on Apache Web Server

				
					sudo certbot --apache -d example.com -d www.example.com
				
			

Create the SSL certificates without modifying system files (Only install SSL certs)

				
					sudo certbot certonly --apache
				
			
				
					sudo certbot certonly --nginx
				
			

Step 2: Enter an email address for renewal and security notices.

How to Install Let’s Encrypt SSL (Certbot) on Ubuntu with Automatically Renew

Step 3: Agree to the terms of service.

Step 4: Specify whether to receive emails from EFF.

Step 5: If prompted, choose whether to redirect HTTP traffic to HTTPS – 1 (no redirect, no further changes to the server) or 2 (redirect all HTTP requests to HTTPS).

Automatically Renew Let’s Encrypt Certificates

Certbot certificates expire after 90 days, so it’s essential to set up automatic renewal. Certbot usually creates a cron job for you, but you can verify it’s set up by running:

Step 1: Open the crontab file.

				
					sudo crontab -e
				
			

Step 2: Add the certbot command to run daily

Add the certbot command to run daily. In this example, we run the command every day at noon. The command checks to see if the certificate on the server will expire within the next 30 days, and renews it if so. The –quiet directive tells certbot not to generate output.
				
					0 12 * * * /usr/bin/certbot renew --quiet
				
			
Automatically Renew Let’s Encrypt Certificates (Free SSL)

Step 3: Save and close the file. All installed certificates will be automatically renewed and reloaded.

				
					sudo crontab -l
				
			
That’s it! You’ve installed Let’s Encrypt SSL (Certbot) on Ubuntu and set up automatic renewal. Your website should now be secured with an SSL certificate.

Drop your queries

Table of Contents

Have A Project In Mind? Let's Get To Work