You cannot use them for localhost
sudo apt-get -yy install --no-install-recommends certbot
mkdir -p le
certbot --work-dir ./le --logs-dir le --config-dir le -d localhost.mydomain.com --manual --preferred-challenges dns certonly
Follow the instructions adding the TXT record, you have a valid cert in minutes.