Install OpenSSL Apache Certificate On Ubuntu 18.04 to 20.04

Open SSL is a cryptography library used for the open-source application of the TLS protocol. Implemented in 1998 and available for Linux, Windows, macOS, and BSD systems. Once OpenSSL is installed, users will perform various SSL-related tasks including CSR (Certificate Signing Request) and private keys generation and SSL certificate installation.

OpenSSL allows you to apply for the digital certificate (Generate the Certificate Signing Request) and installs the SSL files on your server. We can also convert certificates into various SSL formats as well as do all kinds of verifications. In this post, we are going to learn how to install OpenSSL with Apache On Ubuntu 18.4 / 20.04

Steps to Install OpenSSL

To install OpenSSL you will require Apache2 installed on your Ubuntu Operating System first. Once Apache is installed and running follow the below steps to install OpenSSL – Https

Step 1

Advertisements

Update and Install Required Packages for OpenSSL

# sudo apt-get update

# sudo apt-get install apache2 openssl

 

Step 2

Enable Apache Module by the following command

# sudo a2enmod ssl

# sudo a2enmod rewrite

 

Advertisements

Step 3

Now, create certificate directory and place private key and website certificate by OpenSSL command

# sudo mkdir /etc/apache2/certificate

# sudo cd /etc/apache2/certificate

# sudo openssl req -new -newkey rsa:4096 -x509 -sha256 -days 365 -nodes -out apache-certificate.crt -keyout apache.key

Fill out the basic details after the OpenSSL command like country name, state, locality etc..

 

Step 4

Edit the Apache2 configuration file in the following location

# sudo vi /etc/apache2/sites-enabled/000-default.conf

Before Edit the configuration file

<VirtualHost *:80>
       ServerAdmin [email protected]
       DocumentRoot /var/www/html
       ErrorLog ${APACHE_LOG_DIR}/error.log
       CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

After Edit and Adding SSL directory path

<VirtualHost *:443>
       ServerAdmin [email protected]
       DocumentRoot /var/www/html
       ErrorLog ${APACHE_LOG_DIR}/error.log
       CustomLog ${APACHE_LOG_DIR}/access.log combined
       SSLEngine on
       SSLCertificateFile /etc/apache2/certificate/apache-certificate.crt
       SSLCertificateKeyFile /etc/apache2/certificate/apache.key
</VirtualHost>

 

Step 5

Finally, restart Apache2 service

# sudo service apache2 restart

 

Step 6

Open any browser on your local system and try to open Https version of your website. To test Https, just put URL as your Apache server IP address along with https. For example, my IP Address is 192.168.10.90 so my Apache test URL will be https://192.168.10.90

Also ReadHow to install LAMP on Ubuntu

Video Tutorial

 

In this tutorial we have covered how to install OpenSSL with on Ubuntu Operating System step by step. Comment below for your queries and suggestion or you can contact me any time via contact page. I will be assisting you and try my best to clear your all doubts.

Leave a Reply

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

TechsBucket