How do I Install OpenSSL Libraries on Ubuntu

OpenSSL, an application security library to provide secure network communication; It is extensively used by major internet servers including HTTP websites. Also, OpenSSL is licensed under an Apache-style license, meaning that it can be freely used for personal and commercial purposes. If you want to install OpenSSL libraries on your Ubuntu to protect your system’s communication when connected to a network, then this article is a guide on how to do that.

Installing OpenSSL Libraries on Ubuntu

There are two methods to install OpenSSL libraries on ubuntu, which are:

Method I: From the Official Repository

To install openSSL libraries on Ubuntu follow the below-written steps:

Step 1: Update/Upgrade Repository

In all the latest Ubuntu distributions, the openSSL package is already present in the official repository. So run the below-mentioned commands to update the repository:

sudo apt update
sudo apt upgrade


Step 2: Install OpenSSL

Then run the below-mentioned command to install openSSL from the official repository, by running this command the openSSL libraries will also get installed:

sudo apt install openssl


In the output you can see a long list of openssl libraries which got installed:

Step 3: Openssl Development Tool

Usually by just installing the openssl package all the libraries of ssl get installed too, but sometimes due to missing development tools some libraries remain uninstalled. So, it is recommended to install the development tool package by using the below-mentioned command:

sudo apt install libssl-dev


Removing OpenSSL Libraries on Ubuntu

To remove the OpenSSL libraries on Ubuntu, any of the below-mentioned commands can be utilized:

sudo apt remove openssl



sudo apt purge openssl


Method II: By Downloading the .tar file

The other method is to manually install OpenSSL by using the .tar file, this allows users to install the latest 3.0 version of openSSL  and for that follow the below-written steps:

Step 1: Installing Necessary Dependencies

To manually install OpenSSL, some dependencies are required, install them by using the below-mentioned command:

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


Step 2: Downloading .tar File

To organize all the OpenSSL libraries, it suggested to change directory to /usr/local/src:

cd /usr/local/src/


Then download the latest version of openSSL .tar file from the official site using the below-mentioned command:

sudo wget https://www.openssl.org/source/openssl-3.0.7.tar.gz


Step 3: Extracting .tar file

After downloading the .tar file, extract it by using the below-mentioned command:

sudo tar -xf openssl-3.0.7.tar.gz


Step 4: Configuring and Compiling OpenSSL Files

Then configure and compile openSSL files by using the below-mentioned commands:

cd openssl-3.0.7


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


Then by using the below-mentioned command compile the files to executable forms:

sudo make


Then install the those executable files by running the below-mentioned command:

sudo make install


Step 5: Configure Link Libraries

Create a new file using nano editor to link the configured libraries:

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


Inside the file paste the path of libraries:



Then save and exit the file.

Step 6: Reload the Dynamic Link

Then reload the dynamic link of configured libraries by using the below-mentioned command:

sudo ldconfig -v


Step 7: Verifying

Finally run the below-mentioned command to verify the installed version of openSSL:

openssl version -a


Removing OpenSSL Libraries

If you want to remove the installed openSSL libraries then for that, manually remove the directory where all the libraries are present, but before that ensure that nothing else except libraries was stored in this directory:

sudo rm -rf cd /usr/local/src/



All the latest versions on Ubuntu have OpenSSL libraries in their repositories. So it is recommended to install the OpenSSL libraries from the repository using the apt command. Also, install the development tools for openSSL to successfully install all the libraries. But if you desire to install the latest version of openSSL then the .tar file method is most suited.

About the author

Zahra Zamir

An Electronics graduate who loves to learn and share the knowledge, my passion for my field has helped me grasp complex electronics concepts and now I am here to share them with others.