How to install openssl 1.0.2 with default openssl (1.1.1) on Ubuntu 16.04?

P4Python does not work on Ubuntu 16.04 since the distribution comes with OpenSSL 1.1.0g.(details). I am trying to build P4Python from source using --ssl path/to/openssl1.0. I need to install OpenSSL 1.0.2 along with the default version of OpenSSL. (Not sure if something would break if I downgrade OpenSSL). How do I install the older version of OpenSSL so that I can just use it for building P4Python?


Solution 1:

This article has a complete answer: https://www.miguelvallejo.com/tag/installing-openssl-1-0-2g-on-ubuntu/

Reformatted slightly:

cURL Method


# (Install cURL library)  
sudo apt-get install php5-curl 

# (Install compiling library Make)  
sudo apt-get install make 

# (single command that will download latest binaries, extract them, cd into the directory, compile configuration and then install the files)  
curl https://www.openssl.org/source/openssl-1.0.2l.tar.gz | tar xz && cd openssl-1.0.2l && sudo ./config && sudo make && sudo make install 

# (This will create a sym link to the new binaries)  
sudo ln -sf /usr/local/ssl/bin/openssl `which openssl` 

# (Used to check the version of the Current OpenSSL binaries)  
openssl version -v 

wget method

# (Install compiling library Make)  
sudo apt-get install make 

# (Download the latest OpenSSL 1.0.2g binaries)  
wget https://www.openssl.org/source/openssl-1.0.2l.tar.gz 

# (Extract the tar ball to the local directory)  
tar -xzvf openssl-1.0.2l.tar.gz 

# (Enter extracted OpenSSL directory)  
cd openssl-1.0.2l 

#  (Configure binaries for compiling)  
sudo ./config

# (install configured binaries)  
sudo make install 

# (This will create a sym link to the new binaries)  
sudo ln -sf /usr/local/ssl/bin/openssl `which openssl` 

# (Used to check the version of the Current OpenSSL binaries)  
openssl version -v