Linux

How to Install Certbot on Ubuntu

Certbot is a free, open-source software tool for automatically using Let's Encrypt certificates on manually-administrated websites to enable HTTPS. It is designed to simplify the process of obtaining and renewing certificates and can automatically update web server configurations to start serving secured pages.

How to Install Certbot on Ubuntu

To install Certbot on Ubuntu and set up SSL certificates, you can follow these steps:

1. Update the Package Index  
   Open a terminal and update the package index using the command:

sudo apt update

2. Install Certbot  
   Install Certbot and its Nginx plugin (if using Nginx) from the official Ubuntu repositories:

sudo apt install certbot python3-certbot-nginx

   If you are using Apache, replace `python3-certbot-nginx` with `python3-certbot-apache`.

3. Run Certbot  
   To automatically configure SSL for Nginx, use the following command:

sudo certbot --nginx  

   If you're using Apache, use:

sudo certbot --apache

4. Follow the Prompts  
   Certbot will ask you to provide an email address for lost key recovery and notices, and you will need to agree to the terms of service. You'll also have the option to set up automatic redirects of all HTTP traffic to HTTPS, enhancing your website's security.

5. Automatic Renewals  
   Let’s Encrypt certificates are valid for 90 days. Certbot typically sets up a cron job or a systemd timer to handle renewals automatically. You can test this using:

sudo certbot renew --dry-run

   This command simulates the renewal process to check for potential errors.

By following these steps, Certbot will handle most of the heavy lifting regarding SSL certificate issuance and installation, making it easier to secure your website with HTTPS.