These instructions work on Debian 10. They may work on other systems.
sudo apt install python3-certbot-nginx
This should take care of any dependencies.
The next step is to get an initial certificate. You should only need to do this once.
sudo certbot --nginx -d mydomain.com -d www.mydomain.com
SSL certificates require occasional updating. Just run the following code:
sudo certbot renew --nginx
You can schedule this via cron as well.