26

I have an Amazon EC2 box. I have installed Apache, MariaDb and PHP on it.

Among other things, I want to host a couple of WordPress websites on the EC2.

How do I go about installing Certbot on Amazon Linux so that I may issue SSL certificates for the various websites hosted on Apache?

I cannot find Amazon Linux listed on Certbot's website, and I read somewhere that Amazon Linux is close to CentOS/RHEL 7 so I picked that and tried to follow the instructions, but I got to

sudo yum install certbot-apache

and it didn't work, I get:

Loaded plugins: langpacks, priorities, update-motd
No package certbot-apache available.
Error: Nothing to do

Any help would be greatly appreciated.

J86
  • 471

7 Answers7

36

For EC2 running Amazon Linux 2 AMI:

Enable EPEL Repo:

sudo amazon-linux-extras install epel

Install Certbot:

sudo yum install certbot-apache
Wu Haa
  • 476
8

You need to enable EPEL

sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Reference: https://aws.amazon.com/premiumsupport/knowledge-center/ec2-enable-epel/

Then certbot installation works,

sudo yum install certbot
0

For Amazon Linux 2023 below worked for me:

sudo yum install python3-certbot-nginx
sudo certbot --nginx
0

Updated answer for Googlers in 2025 (AI still hasn't unseated google):

Amazon Linux 2023 distro was unable to install / use EPEL. However, this guide from certbot worked pretty well: https://certbot.eff.org/instructions?ws=nginx&os=pip

Choose from the top: using nginx and linux (pip) or whatever your web server / reverse proxy and distro may be, and then continue through the guide. I have yum as opposed to dnf which the guide mentions.

Eventually, you will get to this step and will be using pip to install certbot: sudo /opt/certbot/bin/pip install certbot certbot-nginx

Danny
  • 243
0

Follow the steps

  1. Adding the Epel Repostory sudo yum install epel-release

  2. Installing SSL module and the Certbot for Apache

sudo yum install mod_ssl python-certbot-apache

  1. Generating and issuing the certificate using the Certbot

sudo certbot --apache -d example.com -d www.example.com

0

Doing sudo yum install epel-release did not work for me. In fact, the whole epel.repo file was missing for me. According to Amazon's own documentation, it ought to be present in /etc/yum.repos.d/.

I Googled,and found this on GitHub. Following the steps outlined there, I got the epel.repo file, and then my original command to install Certbot worked.

sudo yum install certbot-apache
J86
  • 471
0

This the command below works for me (i'm using the amazon linux version 2)

yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm