Skip to content

Instantly share code, notes, and snippets.

@craigvantonder
Last active April 26, 2022 08:58
Show Gist options
  • Save craigvantonder/6dcc3c9565b04a36f21d6cf6ffa106b4 to your computer and use it in GitHub Desktop.
Save craigvantonder/6dcc3c9565b04a36f21d6cf6ffa106b4 to your computer and use it in GitHub Desktop.
Install and configure LetsEncrypt on Ubuntu Server 14.04 & 16.04 (Apache)
#!/bin/bash
# https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-14-04
# Download the Let’s Encrypt Client
cd /usr/local/sbin
sudo wget https://dl.eff.org/certbot-auto
sudo chmod a+x /usr/local/sbin/certbot-auto
# Set Up the SSL Certificate
certbot-auto --apache -d example.com
# Remove above and uncomment below if you want to include sub domains
#certbot-auto --apache -d example.com -d www.example.com
# Creating a new Cronjob when no Cron jobs exist while running crontab -e as root?
echo "30 2 * * 1 /usr/local/sbin/certbot-auto renew > /var/log/le-renew.log" >> /var/spool/cron/crontabs/root
chown root:root /var/spool/cron/crontabs/root
chmod 600 /var/spool/cron/crontabs/root
# Remove above and uncomment below if you want to append to an existing list of Cron jobs, i.e. Cron jobs exist when running crontab -e?
#echo "30 2 * * 1 /usr/local/sbin/certbot-auto renew >> /var/log/le-renew.log" >> /var/spool/cron/crontabs/root
-- EDIT -- 3 Sept 2021
Since April of 2019, there are no longer updates for Ubuntu 14.04 which seems to have broken the installation steps that are outlined above.
Further to this, it seems that certbot-auto is no longer supported.
I have not tested any solution as no longer make use of 14.04.
This said, in 14.04 you could perhaps try to install snapd:
sudo apt update
sudo apt install snapd
Remove the existing certbot-auto install:
sudo rm -rf /usr/local/sbin/certbot-auto
Then try to use snap to install certbot:
sudo snap install --classic certbot
The steps for 16.04 would perhaps be the same with the only exception being, snap is already installed in 16.04 so you would simply need to update it:
sudo snap install core; sudo snap refresh core
When I had created this gist, the instructions on how to make use of Lets Encrypt were not very clear.
since then things have changed a lot and there is great documentation available for you to make use of:
https://certbot.eff.org/instructions
@tanlaka
Copy link

tanlaka commented May 4, 2020

Thanks, mate. Really helped me

@scotthillson
Copy link

🥳

@ecohort
Copy link

ecohort commented May 19, 2020

Hi, do yo have any script for nginx & ubuntu 14.04?
Thanks!

@akhil-aisplstore
Copy link

I am getting mixed content warnings for all my js and image files after installing this certificate.
Any idea why?

@craigvantonder
Copy link
Author

Hi, do yo have any script for nginx & ubuntu 14.04?
Thanks!

You still need it?

@craigvantonder
Copy link
Author

I am getting mixed content warnings for all my js and image files after installing this certificate.
Any idea why?

Likely because you have linked to the assets in your cost by using http:// and not https://

@akhil-aisplstore
Copy link

akhil-aisplstore commented Jul 6, 2020 via email

@slowdsports
Copy link

Ubuntu 14.04

I'm getting this error:

Skipping bootstrap because certbot-auto is deprecated on this system.
Your system is not supported by certbot-auto anymore.
Certbot cannot be installed.
Please visit https://certbot.eff.org/ to check for other alternatives.

At:
certbot-auto --apache -d example.com

@khurana3192
Copy link

Getting the same error @slowdsports mentioned

@yakkatv
Copy link

yakkatv commented Aug 24, 2021

any help how to install in ubuntu 14 please

@craigvantonder
Copy link
Author

@mdodge-ecgrow
Copy link

On second command, I am getting this error: ERROR: cannot verify dl.eff.org's certificate, issued by ‘/C=US/O=Let's Encrypt/CN=R3’: Issued certificate has expired.

@ss4751
Copy link

ss4751 commented Jan 28, 2022

Hi, i need a script of lets encrypt installation for nginx on ubuntu 14.04?
Thanks!

@nkgokul
Copy link

nkgokul commented Mar 9, 2022

Certificate of dl.eff.org has expired so I tried.
sudo wget https://dl.eff.org/certbot-auto --no-check-certificate

But again getting a 404

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment