How to Install and Configure OpenSSL for Apache on Oracle Linux 8.5
- 00:48 cat /etc/os-release
- 01:04 yum -y install httpd
- 01:25 systemctl enable httpd
- 01:36 systemctl start httpd
- 01:45 systemctl status httpd
- 02:02 firewall-cmd --permanent --add-service=http
- 02:21 firewall-cmd --permanent --add-service=https
- 02:41 firewall-cmd --reload
- 02:57 yum install mod_ssl*
- 03:15 openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/pki/tls/private/apache-selfsigned.key -out /etc/pki/tls/certs/apache-selfsigned.crt
- 04:18 mkdir /var/www/html/test
- 04:35 cd /var/www/html/test
- 05:01 vi index.html
- 05:40 chown -R apache:apache /var/www/html/test
- 05:40 chown -R apache:apache /var/www/html/test
- 05:58 vim /etc/httpd/conf.d/test.conf
- 05:58 vim /etc/httpd/conf.d/test.conf
- 07:09 vim /etc/hosts
- 07:09 vim /etc/hosts
- 07:40 systemctl restart httpd
- 07:40 systemctl restart httpd
To Install and Configure Openssl Certificate for Apache on Oracle linux 8.5
Introduction:
OpenSSL is a general-purpose cryptography library that implements the secure sockets layer (SSL) and transport layer security (TLS) protocols. SSL stands for secure socket layer and, in the simplest terms, it's the standard for keeping an internet connection secure and safeguarding sensitive data that is sent between two systems, preventing criminals from viewing or altering any information sent, including personal details.
Installation Steps:
Step 1: Check the version of OS by using the below command
[root@linuxhelp ~]# cat /etc/os-release
NAME="Oracle Linux Server"
VERSION="8.5"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
Step 2: Install the Apache Web Server by using the below command
[root@linuxhelp]# yum -y install httpd
Package Arch Version Repository Size
Installing:
httpd x86_64 2.4.37-47.0.1.module+el8.6.0+20649+083145da.1
ol8_appstream 1.4 M
Installing dependencies:
Enabling module streams:
httpd 2.4
Install 7 Packages
Installed:
httpd-2.4.37-47.0.1.module+el8.6.0+20649+083145da.1.x86_64
httpd-filesystem-2.4.37-47.0.1.module+el8.6.0+20649+083145da.1.noarch
httpd-tools-2.4.37-47.0.1.module+el8.6.0+20649+083145da.1.x86_64
mod_http2-1.15.7-5.module+el8.6.0+20548+01710940.x86_64
Complete!
Step 3: Enable the services of Apache by using the below command
[root@linuxhelp ~]# systemctl enable httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
Step 4: Start the Services of Apache by using the below command
[root@linuxhelp ~]# systemctl start httpd
Step 5: Check the Status of Apache by using the below command
[root@linuxhelp linuxhelp]# systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor prese>
Active: active (running) since Sat 2022-05-28 03:31:02 IST; 8s ago
Docs: man:httpd.service(8)
Main PID: 39389 (httpd)
Step 6: Add the firewall for http by using the below command
[root@linuxhelp ~]# firewall-cmd --permanent --add-service=http
success
Step 7: Add the firewall for https by using the below command
[root@linuxhelp ~]# firewall-cmd --permanent --add-service=https
Success
Step 8: Reload the Firewall by using the below command
[root@linuxhelp ~]# firewall-cmd --reload
success
Step 9: Install The mod_ssl by using the below command
[root@linuxhelp ~]# yum install mod_ssl*
Installing:
mod_ssl
x86_64 1:2.4.37-47.0.1.module+el8.6.0+20649+083145da.1 ol8_appstream 138 k
Install 1 Package
Total download size: 138 k
Installed size: 266 k
Is this ok [y/N]: y
Downloading Packages:
Installing : mod_ssl-1:2.4.37-47.0.1.module+el8.6.0+20649+083145d 1/1
Running scriptlet: mod_ssl-1:2.4.37-47.0.1.module+el8.6.0+20649+083145d 1/1
Verifying : mod_ssl-1:2.4.37-47.0.1.module+el8.6.0+20649+083145d 1/1
Installed:
mod_ssl-1:2.4.37-47.0.1.module+el8.6.0+20649+083145da.1.x86_64
Step 10: create the SSL key and certificate by using the below command
[root@linuxhelp ~]# openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/pki/tls/private/apache-selfsigned.key -out /etc/pki/tls/certs/apache-selfsigned.crt
Generating a RSA private key
Country Name (2 letter code) [XX]:IN
State or Province Name (full name) []:TN
Locality Name (eg, city) [Default City]:Chennai
Organization Name (eg, company) [Default Company Ltd]:Example
Organizational Unit Name (eg, section) []:Test
Common Name (eg, your name or your server's hostname) []:192.168.6.127
Email Address []:abc@gmail.com
Step 11: Create a Directory in Apache root by using the below command
[root@linuxhelp ~]# mkdir /var/www/html/test
Step 12: change the directory on following path by using the below command
[root@linuxhelp ~]# cd /var/www/html/test
Step 13: Create .html extension file by using the below command
[root@linuxhelp test]# vi index.html
<h1> welocome To Linuxhelp.com</h1>
Step 14: Give Ownership by using the below command
[root@linuxhelp ]# chown -R apache:apache /var/www/html/test
Step15: Create the VirtualHost configuration by using the below command
[root@linuxhelp ~]# vim /etc/httpd/conf.d/test.conf
<virtualhost *:443>
ServerName linuxhelp1.com
Documentroot /var/www/html/test
SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/apache-selfsigned.crt
SSLCertificateKeyFile /etc/pki/tls/private/apache-selfsigned.key
</virtualhost>
Step 16: Create host entry by using the below command
[root@linuxhelp ]# vim /etc/hosts
192.168.6.127 linuxhelp1.com
Step 17: Restart the Apache server by using the below command
[root@linuxhelp test]# systemctl restart httpd
Step 18: Go to Browser and search your domain as shown in the below image
Step 19: click Advanced and Click Accept the Risk and Continue as shown in the below images
Output
Conclusion
We have reached the end of this article. In this guide, we have walked you through the steps required to Install and Configure Openssl Certificate for Apache on Oracle linux 8.5 . Your feedback is much welcome.
Comments ( 0 )
No comments available