We can create CSR using the single command like below.
But make sure you have installed OpenSSL package on your system.
The below command will first create a private key and then generate CSR. This command will also require few details as input.
sudo yum install openssl (
Redhat based systems )
sudo dnf install openssl ( Fedora based systems )
sudo apt install openssl (
Debian based systems )
openssl req -new -newkey rsa:2048 -nodes -keyout domain.example.key -out domain.example.csr
run the following command to generate the CSR required.
Complete the required fields and pay attention to the FQDN as this needs to match the hostname where the SSL is intended to be installed for example mywebshop.co.za will work for both mywebshop.co.za and www.mywebshop.co.za on the same SSL.
Please note that if you are generating CSR for a wildcard certificate, the Common Name should be "*.example.com"
You can opt to skip the passphrase
Once the CSR has been generated you should see some text that looks like below, this is your CSR.
-----BEGIN CERTIFICATE REQUEST-----
MIICzTCCAbUCAQAwgYcxCzAJBgNVBAYTAlpBMRMwEQYDVQQIDApTb21lLVN0YXRl
MSEwHwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQxHDAaBgNVBAMME3N1
cGVyLnRlbXB1cmwuY28uemExIjAgBgkqhkiG9w0BCQEWE3RzaGlmZm1hbkBnbWFp
bC5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDGpa34/icQTxKt
RigDv1Bja7a92LmlldHZShhLT00AKy7HELsPDDtRCi6A8LCxm2z4eRGqP/K12MPI
InBdcWG2i5zTfWhVj9AJkMbP/7MImq6tFK4H8UgqTZ9/vGxfKQDCCryNoEMJj/qg
EuHL7q7npAsUT8CucoGFNkLFYy45sXJm0D1QhTIVKFt3emofFRQWKLT4q8E9kXMH
GFdAxnuJKmjCWIxQFEcgaTzxIRnMXN1kPzsP0Txs8aRSyMmVuV349kZoJkQc+1Ma
6z1pBkCqqjhU3NX6xtaUPuOdnrBPZWY4TBMvVAjANteQEMYGSoYHyAjcmAdcGLgz
ClWRVjeBAgMBAAGgADANBgkqhkiG9w0BAQsFAAOCAQEADxZ4TpZE89eLuiuJIJzW
i5Hz7Q/G84Ha7cJoxc1X27H7TBDjF62l8iOLvjFsiankyzuKUNcYGIl/NvnUsGXq
t2GvancEWyhkUceC1Z0UisBtgFfSpEAtp3o8QWVCH/SMy9eFmbaAUGBG4gMTWO9H
AKwKCnVspZ0i1WiKPNjUiuzoc/8dcRRMf/ILK8H6crsvWMSB2dv6HrtuZX78GxnZ
/VvFGW05Ffsubt2PyGJF09DtLZ/Y4Bq6OtutNJ7bNBVHPiNEOUnhvOpBKcyyro9z
VjVpBpv+7G4Ui9ud60wxHJPPuipGaV9WFfC/HpGEF55ly+/NGeKvMdbC98hWWAgK
XA==
-----END CERTIFICATE REQUEST-----