Install Openssl with source code

|
| By Webner

To install Openssl, we have to perform all steps with the root user. Please check the steps below:

  1. sudo su (Do all operation with root user)
  2. Change the directory to your desire location
    cd /var/www/html/
  3. Make two directories
    mkdir Release
    mkdir Sources
  4. Go to the Sources folder and download the source code
    cd Sources
    wget https://www.openssl.org/source/openssl-1.1.1h.tar.gz

    OutPut:

    ===================================================
    --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

  5. mkdir /var/www/html/Release/openssl
    mkdir /var/www/html/Release/ssl
  6. Configure and Compile it

    ./config --prefix=/var/www/html/Release/openssl --openssldir=/var/www/html/Release/ssl
    make
    make install

    Now 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.

  7. 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
  8. 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

Leave a Reply

Your email address will not be published. Required fields are marked *