Skip to content

Instantly share code, notes, and snippets.

@joshuaquek
Last active March 12, 2021 03:20
Show Gist options
  • Save joshuaquek/916548357b97a9e7583905ff4fc5af89 to your computer and use it in GitHub Desktop.
Save joshuaquek/916548357b97a9e7583905ff4fc5af89 to your computer and use it in GitHub Desktop.
Summary: Simple tutorial on generating a free SSL cert using LetsEncrypt on CentOS / RHEL (via Certbot)
#!/bin/sh
# Install LetsEncrypt Certbot and symlink it
sudo snap install core; sudo snap refresh core
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
# Set your Domain name and your email here
DOMAIN="mydomainnamehere.test.com"
EMAIL="[email protected]"
# Generate the Cert and the Private Key
set -eu
sudo certbot certonly --standalone --agree-tos --non-interactive --email $EMAIL --domains $DOMAIN
# Print out the generated Certificate
sudo cat /etc/letsencrypt/live/$DOMAIN/cert.pem
# Print out the generated Private Key
sudo cat /etc/letsencrypt/live/$DOMAIN/privkey.pem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment