Skip to main content

Install Self Signed Certificate for a domain for 10 years


Things that you need to install the certificate:

  • Key
  • CSR (Certificate Signing Request)
  • Certificate
Here we can create these files  with the openssl command. This can be done from any where. It is not necessary that we need to do this commands in the server itself where the domains hosted. I usually do this in my locale machine.

My example domain is myxyz.com

Creating the Key

############


# openssl genrsa -out myxyz-key.pem 2048

Note: Here if we want to create a more secure key then replace 2048 with 4096

Here we can give any name for the key file, but the only thing is that the extension should be .pem

Creating the CSR

############

# openssl req -new -sha256 -key myxyz-key.pem -out myxyz.csr

Note: Here we need to give the key filename after the -key option.
This command will create a CSR file named myxyz.csr

This command will ask for few options and you can see what I have given for a test case.
 ====================================
jino@localhost4:~$ openssl req -new -sha256 -key myxyz-key.pem -out myxyz.csr  
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) [AU]:US
State or Province Name (full name) [Some-State]:Arizona
Locality Name (eg, city) []:Arizona
Organization Name (eg, company) [Internet Widgits Pty Ltd]:myxyz   
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:myxyz.com
Email Address []:admin@myxyz.com

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
=====================================

Creating the Certificate

################

# openssl req -x509 -sha256 -days 365 -key myxyz-key.pem -in myxyz.csr -out myxyz-certificate.pem

Note: Here -days specifies the period of certificate that we are creating. If you want to create the certificate for 10 Years you have to give that value as 3650


Installing the Certificate

#################


Go to Cpanel
  1. From the SSL/TLS Manager page, under Install and Manage SSL for your site (HTTPS), click Manage SSL sites. The Manage SSL Hosts page appears.
  2. Under Install an SSL Website, Select your domain from the drop down box
  3. Copy paste contents of myxyz-certificate.pem to the box under the "Certificate: (CRT)"
  4. Copy paste the contents of myxyz-key.pem to the box under the "Private Key (KEY)"
  5. Click Install Certificate. cPanel installs the certificate on the server and enables SSL. When the process is complete, you receive an SSL Host Successfully Installed message.

Comments