12

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
  • 301
  • 3
  • 7
  • 15
  • Based on what you wrote you might have missed the step to add the extra repositore Qoute from the link you posted: Certbot is packaged in EPEL (Extra Packages for Enterprise Linux). To use Certbot, you must first enable the EPEL repository. On RHEL or Oracle Linux, you must also enable the optional channel. the link itself : https://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F – Dennis Nolte Mar 21 '18 at 12:20
  • How can I check if the EPEL repository is enabled? Also, I think to add and enable another repo I do `sudo yum-config-manager --enable name`, is that right? – J86 Mar 21 '18 at 12:25
  • this will guide you https://aws.amazon.com/blogs/compute/extending-amazon-linux-2-with-epel-and-lets-encrypt/ – Khan Shahrukh May 10 '19 at 17:29

5 Answers5

24

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
  • 356
  • 2
  • 3
  • I run first, `sudo amazon-linux-extras install epel` and then `sudo yum install certbot` as I need NGINX rather than Apache... – bathyscapher Jun 02 '22 at 08:38
5

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
Amit Rathi
  • 51
  • 1
  • 1
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
  • 301
  • 3
  • 7
  • 15
  • 1
    Warning: EPEL is not guaranteed to be compatible with Amazon Linux. This may eventually break, as it has for others, and probably at the most inopportune time. If you actually needed something from EPEL, consider not using Amazon Linux. – Michael Hampton Mar 21 '18 at 14:56
  • Thanks @MichaelHampton, how do folks on Amazon Linux get their SSL certificates for x number of sites running on Apache. Certbot makes this very easy! – J86 Mar 21 '18 at 16:28
  • There are almost no use cases where Amazon Linux is your best choice of distribution. There might actually not be any at all. I certainly wouldn't run a web site on it. – Michael Hampton Mar 21 '18 at 18:39
  • 1
    @MichaelHampton elaborate please :) Why wouldn't you? And what would be your choice? – J86 Mar 21 '18 at 22:34
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