如何在Ubuntu中将OpenSSL从1.0.2g升级到1.1.0g,并让python识别新的OpenSSL



我有Ubuntu 16.04。它具有OpenSSL 1.0.2g。我需要使用OpenSSL 1.1.0g。请注意,OpenSSL 1.1.0g安装在我的另一台机器Ubuntu 18中。但我需要在Ubuntu 16.04中运行python程序,但我需要特定的OpenSSL 1.1.0g。我做到了:

sudo apt-get upgrade
sudo apt-get update

但是我的Ubuntu机器中的OpenSSL并没有得到更新。如何更新?

我使用pythonsocket, ssl模块在443端口进行TLS连接。如果我将旧的OpenSSL 1.0.2g更新为OpenSSL 1.1.0g,python会自动识别OpenSSL 1.1.0g吗?

升级OpenSSL的原因是我需要运行python程序ssl套接字,但我需要该程序来使用OpenSSL 1.1.0g

当我尝试时:

sudo apt-get install openssl

并通过:openssl version -a检查OpenSSL版本我得到了旧版本的OpenSSL 1.0.2g

如何在我的Ubuntu 14.06机器中获得新版本的OpenSSL 1.1.0g

为什么你不能通过更新来使OpenSSL 1.1.0g在Ubuntu 16.04上运行:

您的Ubuntu 18具有OpenSSL 1.1.0g,因为它的存储库中有可用的版本。有时,它在存储库系统上有多个版本的包可用。但是,看起来Ubuntu 16.04根本没有您需要的版本。这就是为什么你不能,也不能通过更新来让OpenSSL 1.1.0gUbuntu 16.04上工作。存储库上可用的版本不同。

以及如何操作:

您需要手动安装它,或者为Ubuntu 16.04找到一个存储库,使OpenSSL 1.1.0g在系统上可用。我不确定是否有可用的存储库,所以如果你想手动安装它,请按如下操作:

wget https://www.openssl.org/source/old/1.1.0/openssl-1.1.0g.tar.gz
tar xzvf openssl-1.1.0g.tar.gz
cd openssl-1.1.0g
./config
make
sudo make install
openssl version -a

就是这样!

警告。:默认情况下,通过安装系统中不可用的新版本的OpenSSL,您引入了一个与系统维护提供的更新不兼容的版本。你需要自己处理。也许,根据您的情况,只使用默认情况下具有OpenSSL版本的Ubuntu 18是值得的。这是最简单、最安全的方法。

希望一切顺利。祝你好运

以下是我如何从源代码安装最新版本的openssl。

# Install make and packages required to compile the source code
apt-get install -y libfindbin-libs-perl build-essential
# Download source code
wget https://github.com/openssl/openssl/archive/refs/tags/OpenSSL_1_1_1k.tar.gz -O openssl.tar.gz
# Extract source code
tar -xf openssl.tar.gz
# Go to the source code folder
cd openssl-OpenSSL_1_1_1k
# Configure to compile it
./config --libdir=/usr/local/lib
# Compile with 4 parelel jobs
make -j 4
# Install compiled code
sudo make install
# Move older executable
sudo mv /usr/bin/openssl /usr/bin/openssl-1.0.2g
# Create soft symbolic link to the newer version of openssl
sudo ln -s /usr/local/bin/openssl /usr/bin/openssl
# Make visible the new libraries installed at /usr/local/lib
sudo ldconfig

最新更新