How to Install Certbot on Ubuntu with Apache

Certbot is a free and open source tool that helps you secure your website with SSL certificates. It also automates the process of renewing and configuring your certificates, saving you time and hassle.

In this article, you will learn how to install Certbot on Ubuntu with Apache, and how to use it to obtain and manage your certificates.

Prerequisites

Before you begin, you will need:

  • A server running Ubuntu
  • A domain name that points to your server’s IP address
  • Apache web server installed and configured on your server
  • Root or sudo access to your server

Step 1: Install Certbot

The easiest way to install Certbot on Ubuntu is to use the snap package manager. Snap is a universal package system that works across different Linux distributions and platforms.

To install Certbot with snap, run the following commands:

sudo snap install core
sudo snap refresh core
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot

The first two commands will install and update the core snap package, which is required for Certbot. The third command will install Certbot itself, and the fourth command will create a symbolic link to make Certbot accessible from anywhere on your system.

Step 2: Obtain a Certificate

Once you have installed Certbot, you can use it to obtain a certificate for your domain name. Certbot supports different plugins that can help you obtain and install your certificate automatically.

The most common plugin for Apache users is the Apache plugin, which will configure your Apache web server to use the certificate and enable HTTPS on your site.

To use the Apache plugin, run the following command:

sudo certbot --apache -d example.com

Replace example.com with your own domain name. You can also specify multiple domain names with the -d option, separated by commas.

The command will prompt you to enter some information, such as your email address and whether you want to redirect HTTP traffic to HTTPS. After that, Certbot will obtain a certificate from Let’s Encrypt, a free and trusted certificate authority, and install it on your Apache web server.

You can verify that your certificate is working by visiting your website with HTTPS in your browser. You should see a green padlock icon in the address bar, indicating that your connection is secure.

Step 3: Renew and Manage Your Certificates

Certbot will also take care of renewing your certificates before they expire, which is usually every 90 days. You can test the renewal process by running the following command:

sudo certbot renew --dry-run

This will perform a trial run of the renewal process, without actually renewing your certificates. If everything goes well, you should see a message saying that your certificates are not due for renewal yet.

You can also manage your certificates with Certbot, such as deleting, revoking, or updating them. To see a list of all the certificates that Certbot manages on your server, run the following command:

sudo certbot certificates

This will show you the details of each certificate, such as the domain name, expiration date, and path.

To learn more about the different commands and options that Certbot offers, you can check out the official documentation.

Conclusion

In this article, you learned how to install Certbot on Ubuntu Focal with Apache, and how to use it to obtain and manage your SSL certificates. By using Certbot, you can easily secure your website with HTTPS and improve your SEO ranking.

If you have any questions or feedback, feel free to leave a comment below. Thank you for reading! 😊

What are your feelings
Updated on December 14, 2023