How to install OpenSSL on Ubuntu 22.04?

OpenSSL is a software library used for computer network communication and is mostly used by internet servers, including the HTTP websites. The OpenSSL development team is maintaining this robust and commercially used software. The usage of OpenSSL keeps the information shared between the two machines secure from other people and keeps the connections secure.

This post will demonstrate the possible installation methods of OpenSSL on Ubuntu 22.04.

Method 1: Using the Default Repository to Install OpenSSL on Ubuntu 22.04

The default repository contains the installable packages of OpenSSL. The following steps are carried out:

First, update the packages of Ubuntu by running the command:

$ sudo apt update

Confirm the availability of the OpenSSL package in the default repository of Ubuntu by running the command:

$ apt show openssl

After confirming the availability, use the install option of apt package manager to install the package:

$ sudo apt install openssl -y

The package OpenSSL has been successfully installed. Now, verify the installed version of OpenSSL using the command:

$ openssl version

How to Uninstall OpenSSL on Ubuntu 22.04?

It can be removed from Ubuntu using the purge option of the apt package manager. This option will also remove the configuration and other files associated with the OpenSSL:

$ sudo apt purge openssl -y

Method 2: Using the Source Code to Install OpenSSL on Ubuntu 22.04?

Another installation method of OpenSSL on Ubuntu uses the source code method explained in different steps.

Step 1: Open the /usr/local/src/

Open the /usr/local/src directory or any other directory where you feel convenient to download the tar package of OpenSSL:

$ cd /usr/local/src

Step 2: Download the OpenSSL Package

Now download the latest ta package of the OpenSSL with the execution of the command:

$ sudo wget

Step 3: Extract the tar Package

Extract the Downloaded tar package of the OpenSSL:

$ sudo tar -xf openssl-1.1.1q.tar.gz

Step 4: Open the OpenSSL directory

Navigate to the OpenSSL directory with the cd command:

$ cd openssl-1.1.1q

Step 5: Install the Configuration of OpenSSL

Run the below-mentioned command to install configuration of the OpenSSL:

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

Step 6: Compile and Install OpenSSL

Now first compile the downloaded binaries of the OpenSSL using the make command and then install them using the make command:

$ sudo make && sudo make install

Display the Version

To display the version of the installed OpenSSL:

$ openssl version -a

The output shows that OpenSSL is successfully installed on the system.


To install OpenSSL on Ubuntu, run the command “sudo apt install openssl -y” or we can also install the OpenSSL by downloading its binaries and compiling them to install. In this blog, the installation method of OpenSSL on Ubuntu 22.04 has been explained by both methods.