Step1 Installing Cerbot
sudo apt update && sudo apt upgrade
sudo apt install certbot python3-cerbot-apache
Step 2 Verify Apache Configuration
$ cat /etc/apache2/sites-available/your_domain.conf
Make sure it match below:
...
ServerName your_domain
ServerAlias www.your_domain
...
Step 3 Make sure firewall enabled, and allow apache and ssh traffic
sudo ufw status
sudo ufw enable
sudo ufw allow 'Apache Full'
sudo ufw allow ssh
Step 4 Auto config SSL cert for Apache by Certbot apache plugin
$ sudo certbot --apache
Step 5 Verify HTTPS enabled through your browser
Step 6 Let’s Encrypt’s certificates are only valid for ninety days. The certbot script certbot.timer runs twice daily automatically renew any certificate that’s within thirty days of expiration. Lets check status of the cron job.
$ sudo systemctl status certbot.timer
Step 7 Done!