How to Install OpenSSL in Ubuntu - Fedingo (2024)

OpenSSL is an open source library for securing your websites and applications using TLS (Transport Layer Security) and SSL (Secure Sockets Layer) protocol. It is also used for encrypting and decrypting data. OpenSSL works well with most popular web servers including Apache, NGINX, etc. and supports popular encryption algorithms such as MD5, SHA-2, etc. In this article, we will look at how to install OpenSSL in Ubuntu. By default, it is already installed in most Linux systems. But if that is not so in your case or if you want to upgrade your OpenSSL, then you can read on to install OpenSSL from source on your system.

How to Install OpenSSL in Ubuntu

Here are the steps to install OpenSSL in Ubuntu.

1. Update Ubuntu System

Open terminal and run the following command to update your Ubuntu system packages.

$ sudo apt-get update && sudo apt-get upgrade

2. Check OpenSSL version

You may check the version of openssl on your system. If it is present on your system, you will see the latest version number, else it will give you an error.

$ openssl version -a1.1.0

3. Install Prerequisites

Install prerequisites with the following command.

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

4. Download SSL

Run the following command to download the source package of OpenSSL. We are using OpenSSL 1.1.1. You may change it as per your requirement.

$ cd /usr/local/src/$ sudo wget https://www.openssl.org/source/openssl-1.1.1c.tar.gz

Extract the downloaded file with the following command.

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

Navigate to extracted folder.

$ cd openssl-1.1.1c

5. Install OpenSSL

Run the following command to install OpenSSL.

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

6. Configure OpenSSL Shared Libraries

Create a new configuration file openssl-1.1.1c.conf for OpenSSL at /etc/ld.so.conf.d/

$ sudo vi /etc/ld.so.conf.d/openssl-1.1.1c.conf

Add the following line to it.

/usr/local/ssl/lib

Save and exit the file. Reload it with the following command.

$ sudo ldconfig -v

7. Configure OpenSSL Binary

Next, we are going to replace the binary of our old OpenSSL version at /usr/bin/openssl with the new one that we just installed at /usr/local/ssl/bin/openssl

First we backup binary files. Then copy it with the following command.

$ sudo mv /usr/bin/c_rehash /usr/bin/c_rehash.backup$ sudo mv /usr/bin/openssl /usr/bin/openssl.backup

Open environment PATH variable.

sudo vi /etc/environment

Add :/usr/local/bin/openssl folder to PATH variable. Please note the colon at the beginning of folder path.

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

Save and close the file. Now reload the PATH environment with the following command.

$ source /etc/environment

Now if you check the OpenSSL version again, it will show the latest version, indicating that Ubuntu is picking the right OpenSSL.

pre

$ openssl version -a1.1.1

That’s it. In this article, we have looked at how to install/upgrade OpenSSL on your Ubuntu/Debian System.

OpenSSL is a very useful library to generate certificate signing requests, private key-public key pairs, install SSL/TLS certificates and more. It is always advisable to install the latest version of Open SSL on your system to avoid any vulnerabilities and make use of the latest security updates available.

Also read:

How to Reset Root Password in Ubuntu
How to Sort CSV File in Python
How to Read Binary File in Python
How to Read User Input in Python
How to Empty List in Python

How to Install OpenSSL in Ubuntu - Fedingo (2024)

FAQs

How to install OpenSSL in Ubuntu terminal? ›

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.

How to install OpenSSL version in Ubuntu? ›

Install OpenSSL from source
  1. Go to the Downloads page on the OpenSSL website. Copy the link to the version you want to install. ...
  2. Once the archive is on the computer, you can extract the files with: tar -zxvf openssl-3.0.7.tar.gz. ...
  3. Make sure you have the requirements to compile the files: ...
  4. And run these commands to do it:

How to install OpenSSL 3.0 on Ubuntu? ›

Install OpenSSL 3 from Source
  1. NOTE: Red Hat users must not overwrite the current OpenSSL installation located in /usr/bin. ...
  2. Extract the downloaded tar.gz by running the following command: ...
  3. Run the configuration script as shown below (Pay attention to the capital c). ...
  4. Run make test as shown below:

Where is OpenSSL on Ubuntu? ›

OpenSSL is probably the most well known cryptographic library, used by thousands of projects and applications. The OpenSSL configuration file is located at /etc/ssl/openssl. cnf and is used both by the library itself and the command-line tools included in the package.

How to install OpenSSL command line? ›

How To Install OpenSSL on Windows
  1. Step 1 – Download OpenSSL Binary. You need to download the latest OpenSSL windows installer file. ...
  2. Step 2 – Run OpenSSL Installer. Now run the OpenSSL installer on your system. ...
  3. Step 3 – Setup Environment Variables. ...
  4. Step 4 – Run OpenSSL Binary.
Aug 9, 2022

How to install OpenSSL in Linux terminal? ›

  1. Step 1 - Install Dependencies. Before we can compile the OpenSSL library from source, the first step is to install some package dependencies, including the 'build-essential' package on Ubuntu, or 'Development Tools' package on CentOS. ...
  2. Step 2 - Download OpenSSL. ...
  3. Step 3 - Install OpenSSL. ...
  4. Step 4 - Testing. ...
  5. 39 Comment(s)

How to install OpenSSL in Ubuntu 20? ›

  1. Go to the official website and download the source code for the version you need.
  2. Then unzip the update package and execute the following command ./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl -Wl,-rpath,/usr/local/ssl/lib shared.

How to install OpenSSL specific version? ›

Installing OpenSSL
  1. Log into your server via SSH.
  2. Once both files are downloaded, view the checksum to confirm the version you downloaded is safe to use. ...
  3. Decompress this file. ...
  4. Change into the new openssl directory. ...
  5. Configure the file: ...
  6. Run make. ...
  7. Run make install. ...
  8. Change back to your home directory.
Jun 13, 2022

Is OpenSSL installed on Linux by default? ›

openssl is installed by default on Arch Linux (as a dependency of coreutils). There are various OpenSSL library bindings available for developers: python-pyopenssl.

How to install free SSL in Ubuntu? ›

Install Certbot in Ubuntu with PIP
  1. First, install PIP: sudo apt install python3 python3-venv libaugeas0.
  2. Set up a virtual environment: sudo python3 -m venv /opt/certbot/ ...
  3. Install Certbot on Apache (or NGINX): sudo /opt/certbot/bin/pip install certbot certbot-apache. ...
  4. Create a symlink to ensure Certbot runs:
Feb 28, 2022

How to change OpenSSL version in Ubuntu? ›

Please find the below steps to update openssl on your server:
  1. Check your openssl version. # openssl version. ...
  2. Download the latest version of openssl from: http://www.openssl.org/source/ ...
  3. Extract openssl-1.0.1g.tar.gz. Go to openssl-1.0.1g directory. ...
  4. Done.
  5. Check the if you you have the latest version.

How to install OpenSSL 3 in Linux? ›

Steps to install latest OpenSSL on Linux server

The best way to install OpenSSL is to download binaries from OpenSSL official websites. This tutorial will help you to install latest OpenSSL on old Linux systems like CentOS 7, RHEL 7, Oracle Linux 7, Ubuntu 20.04 or Debian 10. Prerequisites: sudo privileges.

Where do I find OpenSSL? ›

OpenSSL for Windows has now been installed and can be found as OpenSSL.exe in C:\OpenSSL-Win32\bin\. Always open the program as Administrator. This can be solved as following: Close OpenSSL.

How do I access OpenSSL? ›

How to use OpenSSL on Windows? To run the program, go to the C:OpenSSL-Win32bin directory and double-click the file openssl.exe. A text window will open with an OpenSSL> prompt. Enter the OpenSSL for Windows you need at this prompt.

How to find OpenSSL location in Linux? ›

Find the path to the trusted certificates
  1. OPENSSLDIR: "/etc/sfw/openssl " (Solaris)
  2. OPENSSLDIR: "/var/ssl" (AIX)
  3. OPENSSLDIR: "/etc/pki/tls" (RHEL)
  4. OPENSSLDIR: "/etc/ssl" (SLES)
  5. OPENSSLDIR: "/usr/lib/ssl" (Ubuntu)

How to install OpenSSL in Ubuntu 22? ›

Check out the provided instructions for installing OpenSSL using wget.
  1. Step 1: Install prerequisites. ...
  2. Step 2: Change the Directory. ...
  3. Step 3: Download the Latest file of OpenSSL. ...
  4. Step 4: Extract the openssl-3.1. ...
  5. Step 5: Change the working directory to manipulate the OpenSSL content. ...
  6. Step 6: OpenSSL configuration.
May 5, 2023

How to install using terminal in Ubuntu? ›

Open a Terminal window.

If you know the name or type of software package you want to install, you can easily install it from the command line using the apt-get command. To launch the Terminal, press Ctrl + Alt + T on your keyboard.

How to install via terminal Ubuntu? ›

GEEKY: Ubuntu has by default something called APT. To install any package, just open a terminal ( Ctrl + Alt + T ) and type sudo apt-get install <package name> . For instance, to get Chrome type sudo apt-get install chromium-browser . SYNAPTIC: Synaptic is a graphical package management program for apt.

Top Articles
Latest Posts
Article information

Author: Prof. Nancy Dach

Last Updated:

Views: 5829

Rating: 4.7 / 5 (77 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Prof. Nancy Dach

Birthday: 1993-08-23

Address: 569 Waelchi Ports, South Blainebury, LA 11589

Phone: +9958996486049

Job: Sales Manager

Hobby: Web surfing, Scuba diving, Mountaineering, Writing, Sailing, Dance, Blacksmithing

Introduction: My name is Prof. Nancy Dach, I am a lively, joyous, courageous, lovely, tender, charming, open person who loves writing and wants to share my knowledge and understanding with you.