Are these files for Certbot?

Hello,
Are these files for Certbot or Apache?

/etc/pki/tls/private/localhost.key 
/etc/ssl/certs/localhost.crt

If these file removed then what’s happening?

Thank you.

Most likely they are put there by some package from your OS. Neither certbot nor Apache.

Apache might “use” those files in a configuration file, which might end up in an Apache which won’t start.

Why would you like to remove them anyway?

If I removed them suddenly then how can I generate them?

Reinstall the package which put the files there in the first place. Use Google to identify the package, which probably depends on the Linux distribution you’re using but neglected to mention as you didn’t follow the mandatory questionnaire which should have been presented to you when you started this thread.

Also, this isn’t Let’s Encrypt related.

I googled and found:

On the Red Hat server, a pair of certificate and key had been installed by default: 
/etc/pki/tls/certs/localhost.crt. /etc/pki/tls/private/localhost.key

But, I’m not sure.
I don’t know below command is OK or not?

# openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/pki/tls/private/localhost.key -out /etc/ssl/certs/localhost.crt

In this community I found:

/usr/libexec/httpd-ssl-gencerts

But, is it same as “openssl” ?