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!