Categories: 20.04Ubuntu 20.04

How to Setup Let’s Encrypt (Certbot) on Ubuntu 20.04

Certbot is an command line utility for managing Let’s Encrypt SSL certificates on a Linux system. It allows you to request a new SSL certificate, do the authorization and configure your web server for SSL settings. It also helps you to renew certificates issued by the Let’s Encrypt certificate authority.

This tutorial help you to install Let’s Encrypt client on Ubuntu 20.04 LTS Linux system.

Prerequisites

You must fulfill the followings:

  • A running Ubuntu 20.04 system with sudo privileged account access.
  • Apache web server with virtual host configured with a real domain or subdomain.
  • Domain or sub-domain must be pointed correctly to web server IP address.

Sponsored
class="heading1">Step 1 – Installing Certbot

Certbot is a tool to obtain certificates from Let’s Encrypt and configure on your web server. Snap package is the easist way for installing certbot on Ubuntu system.

Open a terminal and execute below command to install certbot:

sudo snap install --classic certbot 

Step 2 – Generate SSL Certificate

Now, You can request SSL certificates from Let’s encrypt based on the web server.

  1. Apache – The systems running Apache web server, execute the following command. This will list all the domains/sub-domains configured on your web server. Select appropriate numbers to request certificate.
    sudo certbot --apache 
    
  2. Nginx – For the systems running Nginx web server, use below command to request for the SSL certificates.
    sudo certbot --nginx 
    
  3. Other Web Server – For the system having any other web servers running except Apache or Nginx. Then you can get the certificate only and configure them manually.

    This command will ask you for domain name and document root for the domain.

    sudo certbot certonly --webroot 
    
  4. No Web Server – The systems have no web server running, can also request a ssl certificate. Below command will ask your for the domain name and start a temporary web server on port 80 to complete the verification.
    sudo certbot certonly --standalone 
    

In all of the above cases, the domain must be pointed to your server from dns. Also insure that /.well-known/acme-challenge are served by the webserver.

Sponsored

Step 3 – Test SSL

Once the SSL certificate is installed on the web server, visit https://your-domain.com/ in a web browser and look for the SSL lock icon in the URL bar. You can also do a security scan for the SSL setup on https://www.ssllabs.com/ssltest/.

Step 3 – Renew SSL Certificate

Let’s encrypt certificates are issues for 3 months only. You can renew certificate before 30 days of expiry. Certbot allows you a hassle free renewal just by running a single command.

Run the below command to renew all the certificates on that system.

sudo certbot renew 

You can also run a dry run without actual renewal. This will help you to test if SSL renewal perform well.

sudo certbot renew --dry-run 

Conclusion

In this tutorial, you have learned to install certbot on Ubuntu system. Also helped you to create new certificates for your web servers.

The post How to Setup Let’s Encrypt (Certbot) on Ubuntu 20.04 appeared first on TecAdmin.

Ubuntu Server Admin

Recent Posts

Native integration now available for Pure Storage and Canonical LXD

June 25th, 2025 – Canonical, the company behind Ubuntu, and Pure Storage, the IT pioneer…

9 hours ago

Revolutionizing Web Page Creation: How Structured Content is Slashing Design and Development Time

Co-authored with Julie Muzina A year ago, during our Madrid Engineering Sprint, we challenged ourselves…

1 day ago

Ubuntu Weekly Newsletter Issue 897

Welcome to the Ubuntu Weekly Newsletter, Issue 897 for the week of June 15 –…

2 days ago

Ubuntu Core is now available on MediaTek’s Genio platform

This is the first optimized Ubuntu Core image available on MediaTek’s Genio 350, 510, 700,…

2 days ago

Effective infrastructure automation to reduce data center costs

Data centers are expensive: automation is the solution Today, managing a data center requires striking…

5 days ago

What are our partners building for device makers? Explore the highlights from Ubuntu IoT Day Singapore

Our first Ubuntu IoT Day in Southeast Asia – and our first ever event in…

6 days ago