sudo apt update
sudo apt install python3 python3-venv libaugeas0
# remove if installed from package manager, use python version
# sudo apt-get remove certbot
sudo python3 -m venv /opt/certbot/
sudo /opt/certbot/bin/pip install --upgrade pip
sudo /opt/certbot/bin/pip install certbot certbot-nginx
sudo ln -s /opt/certbot/bin/certbot /usr/bin/certbot
sudo certbot certonly --manual --preferred-challenges dns -d mydomain.comCertbot will ask for a new TXT entry in your domain manager (GoDaddy, Squarespace, ...).
Create the TXT with low TTL in your domain manager.
It may take some time, so, in a new terminal session (can be your local machine) run nslookup at every 5 seconds to see the TXT response until it matches the asked value.
watch -n 5 nslookup -type=TXT _acme-challenge.mydomain.comAfter it is confirmed, add +x permission to give other users access to it.
sudo chmod +x /etc/letsencrypt/liveCertificate is saved at: /etc/letsencrypt/live/mydomain.com-xyz/fullchain.pem
Key is saved at: /etc/letsencrypt/live/mydomain.com-xyz/privkey.pem