How to Install the latest OpenSSL version on Debian 11

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

Hello, friends. OpenSSL is a vital component for many systems, and knowing how to install the latest version of it on Debian 11 could be quite useful.

OpenSSL is a robust, commercial-grade, full-featured toolkit for general-purpose cryptography and secure communication. This makes it an almost indispensable component of any current Linux system.

Debian 11 is a great distribution but does not always incorporate modern software, so it can be important to install the latest version of this toolkit. So let’s go.

Installing the latest version of OpenSSL on Debian 11

Preparing the system for the latest version of OpenSSL

Before doing anything else, it is a good idea to have the system up to date

sudo apt update
sudo apt upgrade

Thereafter, check what version of OpenSSL you have in Debian 11.

openssl version -a

You will get an output screen similar to this one

OpenSSL 1.1.1n  15 Mar 2022
built on: Fri Jun 24 20:22:19 2022 UTC
platform: debian-amd64
options:  bn(64,64) rc4(8x,int) des(int) blowfish(ptr) 
compiler: gcc -fPIC -pthread -m64 -Wa,--noexecstack -Wall -Wa,--noexecstack -g -O2 -ffile-prefix-map=/build/openssl-qQYEec/openssl-1.1.1n=. -fstack-protector-strong -Wformat -Werror=format-security -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DAESNI_ASM -DVPAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -DNDEBUG -Wdate-time -D_FORTIFY_SOURCE=2
OPENSSLDIR: "/usr/lib/ssl"
ENGINESDIR: "/usr/lib/x86_64-linux-gnu/engines-1.1"
Seeding source: os-specific

The best and safest way to get the latest stable version of OpenSSL on Debian 11 is to compile the source code of the tool. So install the dependencies.

sudo apt install build-essential checkinstall zlib1g-dev

Now we can continue.

Download and install the latest version of OpenSSL

To start the download, you should know which is the latest stable version, currently it is 3.0.7 but it is always good to check in this link.

cd /usr/local/src/
wget https://www.openssl.org/source/openssl-3.0.7.tar.gz
Download OpenSSL on Debian 11
Download OpenSSL on Debian 11

Unzip it using the tar command

sudo tar -xf openssl-3.0.7.tar.gz

Access the generated folder

cd openssl-3.0.7

Then, configure the compilation with the required parameters.

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

The first two refer to the directory where the new version will be installed, and shared and zlib are parameters that force the package to create a directory for shared libraries and use the zlib compression.

When finished, compile OpenSSL

sudo make
Compiling the source code of OpenSSL
Compiling the source code of OpenSSL

When finished, you can then test the process.

sudo make test

If all goes well, you can then install OpenSSL.

sudo make install
Install the latest version of OpenSSL on Debian 11
Install the latest version of OpenSSL on Debian 11

When finished, you will have the latest version of OpenSSL, but there are still a few things to do.

Preparing OpenSSL for Debian 11

The first thing we have to do is to configure the new library directory, to accomplish this, create a specific configuration file

cd /etc/ld.so.conf.d/
sudo nano openssl-3.0.7.conf

In this file place the following

/usr/local/ssl/lib64

Save the changes and close the editor.

Apply the changes by running

sudo ldconfig -v

The next step is to configure the new binary so that you will have no problems using it.

sudo nano /etc/environment

Then, add the following

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/ssl/bin"

Apply the changes

source /etc/environment

This should be enough. Thereafter, test if everything went well by running

openssl version -a
Debian with the latest version of OpenSSL
Debian with the latest version of OpenSSL

As you can see, the process was successful, and you can now enjoy the latest stable version of OpenSSL.

Conclusion

Now you know how to enjoy the latest stable version of OpenSSL in Debian 11 with a few simple steps. I hope you find this post very useful.

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"
Angelo
Angelo
I am Angelo. A systems engineer passionate about Linux and all open-source software. Although here I'm just another member of the family.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook