I am trying to create batch file to do all this.
#!/bin/bash
openssl req -newkey rsa:4096 -x509 -sha512 -days 3650 -nodes -out certificate.pem -keyout privatekey.pem
openssl x509 -outform der -in certificate.pem -out certificate.crt
sudo mv certificate.pem,certificate.crt,privatekey.pem...