How to Install the latest OpenSSL version from Source on Linux

因為要安裝其他的元件, 但都會顯示錯誤訊息:

checking OpenSSL library version >= 3.0.0...

Found   OPENSSL_VERSION_NUMBER 0x101010bf (OpenSSL 1.1.1k  FIPS 25 Mar 2021)
Require OPENSSL_VERSION_NUMBER 0x3000000f or greater (3.0.0)

取得 openssl 版本的指令:

openssl version -a

使用前是 OpenSSL 1.1.1k

使用後是 OpenSSL 3.0.8

Install Dependencies

On Ubuntu

Update the Ubuntu repository and install package dependencies for software compilation using the apt command below.

sudo apt update
sudo apt install build-essential checkinstall zlib1g-dev -y

On CentOS

Install the ‘Development Tools’ and some packages libraries using the yum command.

yum group install 'Development Tools'
yum install perl-core zlib-devel -y

Download OpenSSL

OpenSSL site:
https://www.openssl.org/source/

Go to the ‘/usr/local/src’ directory and download the OpenSSL source code using wget.

cd /usr/local/src/
wget https://www.openssl.org/source/openssl-3.0.8.tar.gz

Now extract the openssl.tar.gz file, and go to the ‘openssl’ directory.

tar -xf openssl-3.0.8.tar.gz
cd openssl-3.0.8

Install OpenSSL

 check the installed version using the command below.

openssl version -a

Install and Compile OpenSSL

Go to the openssl downloaded directory ‘/usr/local/src/openssl’.

cd /usr/local/src/openssl-3.0.8

Configure and compile OpenSSL with the commands below.

./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared zlib

make
make test
make install

Configure OpenSSL Binary

Backup the binary files.

mv /usr/bin/openssl /usr/bin/openssl.bak

add /usr/local/ssl/bin/ to $PATH.

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *