openssl genrsa -out private_key.pem 2048
#where private_key.pem == key file name
#2048 == bit size of the key
#To view the private key
cat private_key.pem
# To generate public key from the private key
openssl rsa -in private_key.pem -outform PEM -pubout -out public_key.pem