Linux - How to install ssl certificate via shell, SSL certificate Installation

How to install ssl certificate via shell

How to install SSL certificate via shell

SSL certificate Installation via shell


We used to install ssl using WHM of the server creating csr and then installating ssl using the ssl certificate. The same can

be done in the shell using the steps given below.

SSL Installation Using Shell
This aricle will help you to create csr key and ssl certificate through command prompt or shell.

How to generate the csr via shell
   # /scripts/gencrt
The gencrt script will generate the csr key. This will ask you all the information like email address, domain name, country

code, City, Company, etc.. fill the values and it generates a csr certificate and a private key.

   # cd /etc/ssl/certs

The csr is generated in the file /etc/ssl/certs/domainname.csr
   # less domainname.csr
The csr will be generated in the domainname.csr file.

   #  vi domainname.crt
Create .crt file and paste ssl certificate into .crt file

   # vi domainname.cabundle
Create .cabundle file and paste cabundle key in domainname.cabundle file. If cabundle is provided else skip this step.

   # cd /etc/ssl/private

   # ls -ld | grep domainname.key
Check whether private key is already present for domain name.

Add ssl virtual host entry in the apache file.
   # vi /etc/httpd/conf/httpd.conf


   <IfDefine SSL>
   <VirtualHost IPaddress:443>
   ServerAlias domainname
   ServerAdmin webmaster@domainname
   DocumentRoot /home/username/public_html
   BytesLog domlogs/.com-bytes_log
   ServerName domainname
   User username
   Group username
   CustomLog /usr/local/apache/domlogs/domainname combined
   ScriptAlias /cgi-bin/ /home/username/public_html/cgi-bin/
   SSLEnable
   SSLCertificateFile /usr/share/ssl/certs/domainname.crt
   SSLCertificateKeyFile /usr/share/ssl/private/domainname.key
   SSLCACertificateFile /usr/share/ssl/certs/domainname.cabundle   
# If cabundle is not given by client then remove this line
   SSLLogFile /usr/local/apache/domlogs/domainname-ssl_data_log
   SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
   </VirtualHost>
   </IfDefine>

   # service httpd restart

SSL certificate is installed and you are able to access domain with https://

Thats it, now you have installed the ssl certificate successfully. This aricle would have helped you to create csr key and

ssl certificate via WHM-cPanel

The topic on Linux - How to install ssl certificate via shell is posted by - Math

Hope you have enjoyed, Linux - How to install ssl certificate via shellThanks for your time

Tech Bluff