I want to use OpenSSL1.1.1 version for my code development. Currently I am working with Openssl 1.1.0g on Ubuntu 18.04 machine.
If I download the package with the command sudo apt install libssl-dev
, then I get OpenSSL 1.1.0g version,
If I download the package with the command sudo apt install libssl1.0-dev
, then I get OpenSSL 1.0.2n version,
How do I download the OpenSSL 1.1.0 and libssl package?
Note: I don't want to download OpenSSL package separately and build it externally. I am supposed to download using an Ubuntu package.
Best Answer
In fact your question was duplicate and the same question already appeared in Upgrade openssl 1.1.0 to 1.1.1 in Ubuntu 18.04.
As already answered by @Kevin Bowen, openssl 1.1.1 is not in the current Ubuntu repositories, you will need to download, compile, and install the latest OpenSSL version manually.
The same thing I too suggested in the beginning in
comments
section. My favorite is always to install in/opt
, so I suggested that too incomments
section.If you don't want to do, then you will be stuck for ever!
Guide to install the latest version of
openssl 1.1.1b
on Ubuntu 18.04.Step 1 : Download openssl 1.1.1b
Download the latest openssl 1.1.1b release from from Ubuntu source package….
OpenSSL Cryptography and SSL/TLS Toolkit
Figure-1: Download openssl 1.1.1b
You can also easily install openssl 1.1.1b package by running the commands below…
wget https://www.openssl.org/source/openssl-1.1.1b.tar.gz
Step 2 : Install Openssl from the tar.gb package
Now create
/opt/openssl
directory:$ sudo mkdir /opt/openssl
Figure-2: Create folder for openssl under /opt directory.
Now that you’ve downloaded the correct archive package for your system into
~/Downloads
folder, run the following commands to installOpenssl
.Figure-3: Extraction into /opt/openssl is complete.
$ perl --version
Figure-4: Perl version.
Export
LD_LIBRARY_PATH
environment variable with the following value:Verify that
LD_LIBRARY_PATH
is set with correct value by this command:Figure-5: Value of environment variable LD_LIBRARY_PATH is /opt/openssl/lib.
Issue the
config
commands:Figure-6: config command
Next, issue
make
command:$ sudo make
Issue
make test
command to check for possible errors:$ sudo make test
Figure-7: Bingo! All tests successful.
Issue
make install
commands:$ sudo make install
Where is
openssl
binary being located?Issue the following commands:
Figure-8: Locate openssl binary.
The directory
/usr/bin
also hasopenssl
binary which is an earler version. The presence of thisunwanted openssl
binary/usr/bin/openssl
is going to cause us trouble, so we have to check this out!Issue the following commands in order to tackle
/usr/bin/openssl
binary:Figure-9: Rename earlier version of openssl binary to openssl.old.
Step 3 : Setup
PATH
environment variableOpenssl
needs to setPATH
environment variables which is to be set as shown below.Create a file called
openssl.sh
under/etc/profile.d/
directory.Add the following contents:
Save and close the file. Make it executable using the following command.
Then, set the environment variables permanently by running the following command:
Log out or reboot your system.
Now, check the
PATH
environment variable:$ echo $PATH
Figure-10: PATH envirnement variable having /opt/openssl/bin directory
$ which openssl
Figure-11: The binary 'openssl' is under '/opt/openssl/bin' directory
Now, check the
openssl version
using command:$ openssl version
Figure-12: openssl latest version
Now, check the openssl version using command line tool:
$ openssl
Figure-13: Check version through 'openssl' command line.
What will happen if
LD_LIBRARY_PATH
is not properly set?$ openssl
Figure-14: Error thrown by 'openssl' command line when 'LD_LIBRARY_PATH' is not properly set.
As decribed by
Step-3
, you must setLD_LIBRARY_PATH
to correct value which is/opt/openssl/lib
$ export LD_LIBRARY_PATH=/opt/openssl/lib:$LD_LIBRARY_PATH
Summary:
This method downloads, extracts, compiles, and installs the latest OpenSSL version 1.1.1b manually.