A Web.com Partner
Sign Up / Log In
Online Support Linux Servers

How to create a Self-Signed SSL Certificate in Linux?

You can create a self-signed SSL certificate in Linux by following these instructions:

  1. Open your VPS console from the Power Management control panel.
  2. Log in to your VPS by entering your username and password.
  3. Create an SSL private key using the following command:
    # openssl genrsa -des3 -out self-ssl.key 2048

    The output should look like this:

    Generating RSA private key, 1024 bit long modulus
    ...++++++
    ...............++++++
    e is 65537 (0x10001)
    Enter pass phrase for self-ssl.key: Type-Your-PassPhrase-Here
    Verifying - Enter pass phrase for self-ssl.key: Retype-Your-PassPhrase-Here
    
  4. Create a Certificate Signing Request (CSR) using the following command:
    # openssl req -new -key self-ssl.key -out self-ssl.csr

    The output should look like this:

    Enter pass phrase for self-ssl.key: Type-Your-PassPhrase-Here
    You are about to be asked to enter information that will be incorporated
    into your certificate request.
    What you are about to enter is what is called a Distinguished Name or a DN.
    There are quite a few fields but you can leave some blank
    For some fields there will be a default value,
    If you enter '.', the field will be left blank.
    -----
    Country Name (2 letter code) [XX]:AU
    State or Province Name (full name) []:WA
    Locality Name (eg, city) [Default City]:Perth
    Organization Name (eg, company) [Default Company Ltd]:samplecompany pty
    Organizational Unit Name (eg, section) []:IT
    Common Name (eg, your name or your server's hostname) []:myserver.example.com
    Email Address []:admin@myserver.example.com
    Please enter the following 'extra' attributes
    to be sent with your certificate request
    A challenge password []:
    An optional company name []:
  5. Generate the SSL certificate using the following command:
    # openssl x509 -req -days 365 -in self-ssl.csr -signkey self-ssl.key -out self-ssl.crt

    The output should look like this:

    Signature ok
    subject=/C=AU/ST=WA/L=Perth/O=samplecompany pty LTD/OU=IT/CN=myserver.example.com/emailAddress=
    admin@myserver.example.com
    Getting Private key

Congratulations, you have сreated self-signed SSL certificate in Linux.

Was this helpful? Yes No 65% of people found this helpful.
{"message":""}