5

How do I install Let's Encrypt Certificates on amazon Linux I already have a WordPress website hosted.

Can anyone tell me the steps how do i start with it and what are the commands and what permission I should change and how do i edit ssl.conf and add certificates and auto renew.

1

3 Answers 3

7

Amazon's EPEL doesn't seem to have certbot for me. Try manually installing it, here's a pair of articles with full instructions:

Try https://ivopetkov.com/b/let-s-encrypt-on-ec2/ for Apache

Or https://coderwall.com/p/e7gzbq/https-with-certbot-for-nginx-on-amazon-linux for Nginx

Short of it is:

wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto
sudo certbot-auto certonly --debug --standalone -d yourdomain.com

--debug is required because Amazon Linux isn't well tested with certbot. Replace --standalone with whichever certbot plugin you perfer. Essentially just replace the standard examples' usage of certbot with certbot-auto.

Probably best if you check every once in a while for certbot to actually show up in Amazon's EPEL repo and/or to re-download certbot-auto in hopes of getting bug fixes/improvements.

UPDATE for "Amazon Linux 2"

There's finally a certbot package in the EPEL Yum Repositories.

sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum-config-manager --enable epel
sudo yum install certbot
sudo certbot certonly --standalone -d yourdomain.com
2
  • Although I think that the links will last longer than the relevance of the specific answer, I've added a summary. Sep 16, 2016 at 18:27
  • This did not work for me on Amazon Linux AMI release 2016.09 - it kept dying here: Nothing to do Creating virtual environment... ./certbot-auto: line 652: virtualenv: command not found needed to install python's virtualenv as well: ```yum install python26-virtualenv.noarch```` Then it worked.
    – wezell
    Feb 15, 2017 at 22:26
0

There are a lot of solutions online; I think you have to keep on trying until you find one that works for you. After a lot of experimentation, what worked for me was following the certbot instructions for Apache and CentOS 6. The official link is here, but for consistency:

Run the following commands in the terminal:

  1. Download Certbot
wget https://dl.eff.org/certbot-auto
sudo mv certbot-auto /usr/local/bin/certbot-auto
sudo chown root /usr/local/bin/certbot-auto
sudo chmod 0755 /usr/local/bin/certbot-auto
  1. Execute Certbot
sudo /usr/local/bin/certbot-auto --apache

If there's an error message, read the warning and run (if you feel comfortable):

sudo /usr/local/bin/certbot-auto --apache --debug

Here, you may be asked to complete some fairly intuitive questions to configure your installation. If not, what worked for me won't work for you. :(

  1. Automate Renewal

Test to see if renewing your certificate works:

sudo /usr/local/bin/certbot-auto renew --dry-run

If so, navigate to your system's crontab (usually somewhere around /etc/crontab/) and add the following code to check (and run, if necessary) and auto-renewal at midnight and noon everyday:

0 0,12 * * * python -c 'import random; import time; time.sleep(random.random() * 3600)' && /usr/local/bin/certbot-auto renew 
0

alternative to set it on nginx:

you can use

sudo yum install python2-pip

sudo pip2 install certbot

for me is python2.7 so:

cd /usr/lib/python2.7/site-packages 

then run

sudo certbot --nginx -d your-domain
1
  • Not working -bash: certbot: command not found
    – Ander
    Apr 14, 2021 at 7:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .