Linux Commands and Scripts

How To Install Apache Let’s Encrypt in Ubuntu

In this article, we will learn to install Apache Let’s Encrypt in Ubuntu 18.04 server.

Let’s Encrypt is a free and Certificate Authority (CA) that provides an easy way to obtain and install free TLS/SSL certificates. Using Certbot, the entire process of obtaining and installing a certificate is fully automated on both Apache and Nginx server. You can get a valid SSL certificate for your domain at no cost for 90 days, during which renewal can take place at any time.

Let’s get started.


  • Ubuntu 18.04 server
  • Access of the server using SSH with root user

1. Keep the server up-to-date

# apt update -y

# apt upgrade -y

2. Add the Certbot repository:

# add-apt-repository ppa:certbot/certbot

You’ll need to press ENTER to accept.

3. Install Certbot’s Apache package with apt:

# apt install python-certbot-apache

4. Obtaining an SSL Certificate

Run this command to get a certificate. Certbot provides a variety of ways to obtain SSL certificates through plugins. The Apache plugin will take care of reconfiguring Apache and reloading the config whenever necessary. To use this plugin, type the following:

# certbot –apache -d your_domain

5. Check automatic renewal

Once the certificate installed, test the renewal process, you can do a dry run with Certbot:

The Certbot packages on your system come with a cron job or systemd timer that will renew your certificates automatically before they expire.

# certbot renew –dry-run

The command to renew Certbot is installed in one of the following locations:

systemctl list-timers

6. Verify that Certbot worked

Access your domain with https:// in your browser. If it shows without giving warning, we have successfully installed Let’s Encrypt using Certbot.

In this article, we have seen how our support engineers Install Apache Let’s Encrypt in Ubuntu 18.04 server using Certbot.

[Need assistance to fix this error or install tools? We’ll help you.]

Related Articles