How to Generate a CSR from command-line

If you found this post helpful, kindly share it and show your support :)

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
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:

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


Mohammed Noufal

I'm Mohammed Noufal, working as Server Admin for the last 10 years.  In my day-to-day life, l had to face different problems related to Web-hosting. On my website, you can find solutions for different Web-hosting-related problems. Sometimes, I spent hours searching/googling to find a solution. This inspired me to start a website that gives solutions to different Webhosting problems. This website includes basic Linux and windows commands, and different control panels like cPanel, Plesk, DirectAdmin, Webmin & so on. You can find solutions and or suggestions for different Web-hosting related problems from here. Hence I would like to say Errorlogz is your server protector.  I will be glad if Logdetect can help any one of the Server admins to find a solution to his problem.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *