CertbotOnUbuntu: Auto SSL Certificates for Apache2 Tutorial on Ubuntu 20.04
Copyright (C) 2020 Exforge exforge@x386.xyz
# This document is free text: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
# This document is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# Automation of SSL and certificate renewal for Apache 2 on Ubuntu
# Totally based on the document at:
https://certbot.eff.org/lets-encrypt/ubuntufocal-apache
# Apache Site configurations without SSL must be ready on your servers
# Refer to ApacheOnUbuntu Tutorial
# 1.1. Snap Daemon
# Certbot is installed as a snap, Ubuntu 20.04 installs snap daemon (snapd)
# by default. If in any case it is not installed, you can install snapd by
# the following command:
sudo apt install snapd
# 1.2. Remove Old Certbot Packages (If any)
# If you've installed certbot's apt package before, remove it:
sudo apt remove certbot
2. Installation and Getting SSL Certificate
# 2.1. Ensure that your snapd (snap deamon) is up to date:
sudo snap install core; sudo snap refresh core
#
# 2.2. Install Certbot
sudo snap install --classic certbot
#
# 2.3. Get SSL Certificate
sudo certbot --apache
# Asks your email, don't hesitate giving it, you will be informed if any problems
# occurs at the renewal of certificates.
#
# 2.4. Test automatic renewal
sudo certbot renew --dry-run
#
# 2.5. All set, certificates generated and installed, all apache
# configurations are made, jobs added to crontab to renew certs.
# Check crontab:
systemctl list-timers