Install Latest OpenSSL on Ubuntu 22.04

This guide intends to teach you to Install the Latest version of OpenSSL on Ubuntu 22.04. OpenSSL is an open-source command line tool that is commonly used to generate private keys, create CSRs, install your SSL/TLS certificate, and identify certificate information. 

How To Install the Latest OpenSSL on Ubuntu 22.04?

The default OpenSSL version available on Ubuntu 22.04 is version 3.0.2. This guide wants to teach you to install the latest version of OpenSSL from source on your Ubuntu 22.04.

To complete this guide, you need some requirements first.

Requirements

You must have access to your server as a non-root user with sudo privileges which allows the user to execute a command as the superuser. To do this, you can follow this guide on Initial Server Setup with Ubuntu 22.04.

Now proceed to the following steps to start your OpenSSL installation.

Step 1 – Install Dependencies for OpenSSL

Because we want to install OpenSSL from the source, you need some dependencies for it.

First, you must run the system update by using the following command:

sudo apt update 

Then, use the command below to install the dependencies for OpenSSL 3:

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

Step 2 – Download Latest OpenSSL Binary Package

At this point, you need to visit the GitHub OpenSSL Releases page and get the latest release by using the wget command:

sudo wget https://github.com/openssl/openssl/releases/download/openssl-3.1.2/openssl-3.1.2.tar.gz

Then, extract your downloaded file by using the command below:

sudo tar xvf openssl-3.1.2.tar.gz

Next, navigate to your OpenSSL directory:

cd openssl-3.1*/

Step 3 – Build and Install OpenSSL on Ubuntu 22.04

At this point, from your OpenSSL directory, run the command below to configure your OpenSSL:

sudo ./config

In your output, you should see:

Output
**********************************************************************
***                                                                ***
***   OpenSSL has been successfully configured                     ***
***                                                                ***
***   If you encounter a problem while building, please open an    ***
***   issue on GitHub <https://github.com/openssl/openssl/issues>  ***
***   and include the output from the following command:           ***
***                                                                ***
***       perl configdata.pm --dump                                ***
***                                                                ***
***   (If you are new to OpenSSL, you might want to consult the    ***
***   'Troubleshooting' section in the INSTALL.md file first)      ***
***                                                                ***
**********************************************************************

Next, use the following commands to build the latest OpenSSL on your Ubuntu 22.04:

# sudo make
# sudo make test
# sudo make install

These may take some time to complete depending on your system.

When you are done, update links and caches by using the command below:

sudo ldconfig

Then, update your system-wide OpenSSL configuration:

sudo tee /etc/profile.d/openssl.sh<<EOF
export PATH=/usr/local/openssl/bin:\$PATH
export LD_LIBRARY_PATH=/usr/local/openssl/lib:\$LD_LIBRARY_PATH
EOF

Reload shell environment:

source /etc/profile.d/openssl.sh

Step 4 – Verify OpenSSL Installation on Ubuntu 22.04

At this point, you can verify your OpenSSL installation on your server by checking its version:

openssl version -a

In your output, you should see that OpenSSL in the latest version has been installed on Ubuntu 22.04:

Output
OpenSSL 3.1.2 1 Aug 2023 (Library: OpenSSL 3.1.2 1 Aug 2023)
built on: Sat Aug 12 09:00:21 2023 UTC
platform: linux-x86_64
options:  bn(64,64)
compiler: gcc -fPIC -pthread -m64 -Wa,--noexecstack -Wall -O3 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_BUILDING_OPENSSL -DNDEBUG

Conclusion

The OpenSSL package version available in Ubuntu 22.04 is 3.0.2. In this tutorial, you will learn to Install the latest OpenSSL from source on Ubuntu 22.04. At the current time, the latest version is 3.1.2. Every time a new version is released, you can use this instruction to install it on your Ubuntu server.

Hope you enjoy it. You may be interested in these articles on the Orcacore website:

Network ifup: failed to bring up eth0:0 Ubuntu

How To Install PySpark on Ubuntu 22.04

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!