We can use openssl Command-line utility to generate private key which will be used for generating certificate Signing Request and Certificate.
openssl genpkey -out server.key -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -aes-128-cbc
You can name your key whatever you like for example key.pem | key.key | sample.hello doesn’t matter what you name the key but the general convention is to use .pem extension.