To install Openssl, we have to perform all steps with the root user. Please check the steps below:
- sudo su (Do all operation with root user)
- Change the directory to your desire location
cd /var/www/html/
- Make two directories
mkdir Release
mkdir Sources - Go to the Sources folder and download the source code
cd Sources
wget https://www.openssl.org/source/openssl-1.1.1h.tar.gzOutPut:
===================================================
--2020-10-22 11:13:52-- https://www.openssl.org/source/openssl-1.1.1h.tar.gz
Resolving www.openssl.org (www.openssl.org)... 104.120.85.66, 2600:1417:75:495::c1e, 2600:1417:75:487::c1e
Connecting to www.openssl.org (www.openssl.org)|104.120.85.66|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9810045 (9.4M) [application/x-gzip] Saving to: ‘openssl-1.1.1h.tar.gz’
openssl-1.1.1h.tar.gz 100%[=====================================================================================>] 9.36M --.-KB/s in 0.1s
2020-10-22 11:13:52 (91.7 MB/s) - ‘openssl-1.1.1h.tar.gz’ saved [9810045/9810045] ===================================================Extract the tar file now:
tar -xvzf openssl-1.1.1h.tar.gz
cd openssl-1.1.1h -
mkdir /var/www/html/Release/openssl
mkdir /var/www/html/Release/ssl -
Configure and Compile it
./config --prefix=/var/www/html/Release/openssl --openssldir=/var/www/html/Release/ssl
make
make installNow we need to create a new command with the new name as I used opensslNEW name, you can use any other name according to you.
Create the soft link in user binary location, check below. -
ln -s /var/www/html/Release/openssl/bin/openssl /usr/bin/opensslNEW
Now check the opensslNEW version.
[root@ip-172-31-7-51 bin]# opensslNEW version -v
opensslNEW: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
If you get the error “cannot open shared object file” then you need to copy the lib files to /usr/lib64 directory -
now copy the new lib file to the global location of libraries /usr/lib64
cp openssl/lib/ /usr/lib64/
There is a total of five lib files that we have to copy in the lib64 global directory, please copy the lib files one by one.now check the version
[ec2-user@ip-172-31-7-51 ~]$ opensslNEW version -v
OpenSSL 1.1.1h 22 Sep 2020