How Do I Install an SSL Certificate on My Linux Server Using Let's Encrypt?

How do I install an SSL certificate on my Linux server using Let's Encrypt?

Before you install the SSL Certificate, you must have the following:

  • A domain name pointing to your server.
  • Root or sudo access to the server.

If you have both of the above, then you can follow the guide below to install your SSL certificate. In this guide, we'll use Certbot, a tool that automates the process of obtaining and installing Let's Encrypt SSL Certificates.

  1. First you must install Certbot, if you're using Ubuntu/Debian run the following command:

    sudo apt update 
    sudo apt install certbot python3-certbot-apache  # For Apache 
    sudo apt install certbot python3-certbot-nginx   # For Nginx
    If you're using CentOS/RHEL, run the following command:

    sudo yum install epel-release
    sudo yum install certbot python2-certbot-apache  # For Apache
    sudo yum install certbot python2-certbot-nginx   # For Nginx
  2. Use the command below to get your SSL certificate. Please replace your_domain in the example below with your actual domain.

    If you're using Apache, run the following command:

    sudo certbot --apache -d your_domain -d www.your_domain 
    If you're using Nginx, run the following the command:

    sudo certbot --nginx -d your_domain -d www.your_domain 
  3. Certbot automatically creates a cron job for certificate renewal. You can test this renewal process with this command:


    sudo certbot renew --dry-run
  4. Finally, restart your web server.

    If you're using Apache, run the following command:

    sudo systemctl restart apache2 

    If you're using Nginx, run the following command:

    sudo systemctl restart nginx 

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article

Modified on Mon, 16 Sep at 8:42 AM

Can’t find what you’re looking for?

Get in Touch

Do you have a pre-sales question?