Install Certbot using below commands,

**Edit the below file, **

sudo nano /etc/apt/sources.list

**Add the below line at bottom to the list, **

    deb http://ftp.debian.org/debian stretch-backports main
sudo apt update
sudo apt install python-certbot-apache -t stretch-backports

Commands to setup SSL Certificate,
Edit the below file (replace example.com.conf filename with your configuration file name.)

sudo nano /etc/apache2/sites-available/example.com.conf

Add the below line,

ServerName example.com;

Configuration testing,

sudo apache2ctl configtest
sudo systemctl reload apache2

Commands to allow secure connection (HTTPS) through the firewall,

sudo ufw status
sudo ufw allow 'WWW Full'
sudo ufw delete allow 'WWW'
sudo ufw status

Commands to obtain an SSL Certificate,

sudo certbot --apache -d example.com -d www.example.com

Select an option (1. No redirect or 2. Redirect) and enter to finish the process.
Commands to Certbot Auto-renewal verification,

sudo certbot renew --dry-run