How to create Self-signed Certificate with Self-signed RootCA

There is some situations that we need to use a self-signed certificate and sign it with our self RootCA. for example when you have an internal service that does not offer public access and just needs a certificate to operate securely. So here we need to know how to Create Self-signed Certificate with Self-signed RootCA.