Wei Guang's Blog

Installing Certbot on Amazon Linux 2023

While hosting my website on Amazon Linux 2023, I intended to use Certbot for generating free HTTPS certificates. However, I encountered issues during the installation process.

Troubleshooting

Initially, my online search for 'How to install Certbot on Amazon Linux' yielded the following instructions:

  1. Enable EPEL:

    sudo amazon-linux-extras install epel
  2. Install Certbot:

    sudo yum install certbot-apache

Unfortunately, executing the first command on my server resulted in the following error:

sudo: amazon-linux-extras: command not found

Upon investigating, I discovered that "amazon-linux-extras" only works with Amazon Linux 2. As I was using Amazon Linux 2023, it was incompatible. Furthermore, I learned that Amazon Linux 2023 doesn't support EPEL or EPEL-like repositories, making the traditional EPEL-enablement followed by a yum installation unsuitable for Amazon Linux 2023. (For more information, refer to https://docs.aws.amazon.com/linux/al2023/ug/compare-with-al2.html)

Solution

After conducting extensive research, I found the appropriate way to install Certbot on Amazon Linux 2023. Interestingly, it can be installed via pip. Simply follow the step-by-step instructions provided in this link:

https://certbot.eff.org/instructions?ws=nginx&os=pip

Please note that for the second step(Install system dependencies), it's essential to use the second command, since Amazon Linux 2023 is based on Fedora:

sudo dnf install python3 augeas-libs

I hope you find this guide helpful🤣.