Openssl
Generate RSA certificate with private key in only one command:
openssl req -batch -nodes -x509 -newkey rsa:2048 -sha256 -keyout example.key -out example.crt
The following commands generate the private key:
openssl genpkey -algorithm RSA -out dev.key
-pkeyopt rsa_keygen_bits:2048 -pkeyopt rsa_keygen_pubexp:65537
openssl genrsa -out private.pem 2048
Generate certificate from the private key:
openssl req -batch -new -x509 -key dev.key -out dev.crt