In order to install Let’s Encrypt, we first need to install the Certbot tool.
Run the following command to install the package:
sudo apt -y install certbot python3-certbot-apache
Now we can run the tool to get Let’s Encrypt certificates. Please note that you must have a valid domain for this to work.
The server must also be reachable from the internet on ports 80 and 443; if not, the process will fail.
Let's get our certificate by running the following command
sudo certbot --apache
For a specific website:
sudo certbot --apache -d shop.opensio.co.in
Test automatic renewal
The Certbot packages on your system come with a cron job or systemd timer that will renew your certificates automatically before they expire. You will not need to run Certbot again unless you change your configuration. You can test automatic renewal for your certificates by running this command:
sudo certbot renew --dry-run
The command to renew certbot is installed in one of the following locations:
cat /etc/cron.d/certbot
add the line of code in crontab -e