How to Install OpenSSL on CentOS 7

OpenSSL is a library that provides cryptographic functionality, specifically SSL/TLS for popular applications such as secure web servers, MySQL databases and email applications.

Step 1: Install Development Tools

To compile OpenSSL manually from sources, you need to first install few dependencies such as “Development Tools” under RHEL/CentOS/Fedora as shown.

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

The following steps describe how to install OpenSSL on CentOS 7.

1. Download the latest version of OpenSSL, do as follows:

# cd /usr/src
# wget https://www.openssl.org/source/openssl-3.0.8.tar.gz

# tar -zxf openssl-3.0.8.tar.gz

2. To install OpenSSL, do as follows:

# cd openssl-3.0.8
# ./config
# make
# make test
# sudo make install

After a successful build, test the libraries and install, OpenSSL installed in /usr/local/ssl location.

3. To check the version of OpenSSL you have just installed, run the following command.

 

# /usr/local/ssl/bin/openssl version

4. To use the newly installed OpenSSL version on your system, you need to add the directory /usr/local/ssl/bin/ to your PATH, in the file ~/.bashrc (or the equivalent for your shell).

# vim ~/.bashrc

Add this line at the bottom of the file.

export PATH="/usr/local/ssl/bin:${PATH}"

Save and close the file and reload the configuration using the command below.

# source .bashrc

5. Now you can view openssl version by just typing below command rather than full path.

# openssl version

If you get error > openssl: error while loading shared libraries: libssl.so.3: cannot open shared object file: No such file or directory centos 7, follow below. 

Sometimes, openssl is installed at /usr/local/ssl, and a file like /etc/ld.so.conf.d/openssl.conf is created. The path to libraries can be added here:

# sudo nano /etc/ld.so.conf.d/lib.conf
/usr/local/lib64
# sudo nano /etc/ld.so.conf.d/openssl.conf
/usr/local/ssl/lib64

After adding the path to the file, update the library paths

# sudo ldconfig

Sanity check

# openssl version

That’s all! 

  • openssl, openssl for centos
  • 0 Users Found This Useful
這篇文章有幫助嗎?

相關文章

How to upgrade PHP to 7.4 in centos 7?

Enter the following commands on the terminal to upgrade PHP:      1 . To install the latest...

Protocol Buffer Compiler Installation

How to install the protocol buffer compiler. While not mandatory, gRPC applications often...

How to Install Go on CentOS 7

Go, often referred to as golang is a modern open-source programming language created by Google....

Configure gRPC for go and protoc

Quick start This guide gets you started with gRPC in Go with a simple working example....