How to Generate a CSR from command-line
You can follow below steps to Generate a CSR from command-line
- Login to the server’s terminal via SSH >> Enter following command to generate a private key and CSR
openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr
Note: Replace “server” with the domain name that you want to generate CSR
- Enter your CSR details
Common Name: The fully-qualified domain name (FQDN) that you want to secure with the SSL certificate such as www.google.com City: Enter the city where the organization is headquartered. State: Enter the state where the organization is headquartered. Country: Enter the country where the organization is headquartered. Use this 2-letter country code. Company Name: Enter the organization name as it is legally registered. Company Division: Enter the department or team within the organization requesting the certificate. Email : Provide your contact valid email address where you can be contacted for verification of domain ownership.
Note: You can skip the field to enter a password or passphrase. This will be an optional field is for applying additional security to your key pair.
That’s it. Your CSR and Private key are created now.
- Locate and open the newly created CSR (.csr file) and Private Key (.key file) in a text editor such as Notepad and copy all the text including:
-----BEGIN CERTIFICATE REQUEST----- And -----END CERTIFICATE REQUEST-----
You can provide CSR and Private key details to your hosting provider to process your SSL request.
You can also generate CSR using Online CSR and Key Generator tool