Linux Commands and Scripts

How To Install OpenSSL 1.1.1d in CentOS

OpenSSL is a robust, commercial-grade, and full-featured toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols. OpenSSL is a software library for applications that secure communications over computer networks against eavesdropping or need to identify the party at the other end.
OpenSSL is licensed under an Apache-style license, which means that you are free to get and use it for commercial and non-commercial purposes subject to some simple license conditions. For a list of vulnerabilities, and the releases in which they were found and fixes, see our Vulnerabilities page.

In this article, we will learn to install OpenSSL 1.1.1d in CentOS 7 KVM VPS instance.

Keep the server up to date

Always keep the server up to date the security purpose.

# yum update -y

Install development tool and dependencies

We need to install a development tool and few dependencies to install OpenSSL

# yum group install ‘Development Tools’ && yum install perl-core libtemplate-perl zlib-devel

Download OpenSSL 1.1.1d

We will download the latest stable version is the 1.1.1 series. This is also our Long Term Support (LTS) version, supported until 11th September 2023.

# cd /usr/local/src/

# wget https://www.openssl.org/source/openssl-1.1.1d.tar.gz

Now, extract the tar file

# tar -xzvf openssl-1.1.1d.tar.gz

Navigate to the extracted directory and configure, build, test and install OpenSSL in the default location /usr/local/ssl.

# cd openssl-1.1.1d

Configure it with PATH

# ./config –prefix=/usr/local/ssl –openssldir=/usr/local/ssl shared zlib

Output:

install openssl 1.1.1d in centos

# make

# make test

# make install

Once we have successfully installed OpenSSL, configure it shared libraries.

Naviagate to the /etc/ld.so.conf.d directory and create a configuration file.

# cd /etc/ld.so.conf.d/

# vi openssl-1.1.1d.conf

Add the following path in the config file

/usr/local/ssl/lib

Save and exit

Reload the dynamic link

# ldconfig -v

Configure OpenSSL Binary

Now, we are going to insert the binary of our new version of OpenSSL /usr/local/ssl/bin/openssl and replace the default openssl file.

First, take a backup of existed openssl file.

# mv /bin/openssl /bin/openssl.backup

Create new environment files for OpenSSL

# vi /etc/profile.d/openssl.sh

and add the following lines

OPENSSL_PATH=”/usr/local/ssl/bin”
export OPENSSL_PATH
PATH=$PATH:$OPENSSL_PATH
export PATH

Save & exit

Make the newly created file executable

# chmod +x /etc/profile.d/openssl.sh

Reload the new OpenSSL environment file and check the default PATH

# source /etc/profile.d/openssl.sh
# echo $PATH

Now, let’s verify the installation and version of the OpenSSL

# which openssl
# openssl version -a

Today, we’ve learned how to installs OpenSSL 1.1.1d in CentOS 7 KVM VPS.

Get a high performance dual E5 series dedicated server and cheap KVM VPS.

Related Articles