How to Install the latest OpenSSL version from Source on Linux (2024)

On this page

  1. What will we do?
  2. Step 1 - Install Dependencies
    1. On Ubuntu
    2. On CentOS
  3. Step 2 - Download OpenSSL
  4. Step 3 - Install OpenSSL
    1. Install and Compile OpenSSL
    2. Configure Link Libraries
    3. Configure OpenSSL Binary
  5. Step 4 - Testing
  6. Reference

OpenSSL is a widely used crypto library that implements SSL and TLS protocols for secure communication over computer networks. Many programs like Apache Web server, PHP, Postfix, and many others use OpenSSL. OpenSSL provides support for various cryptographic algorithms such as ciphers (AES, Blowfish, DES, IDEA etc.), cryptographic hash functions (MD5, MD4, SHA-1, SHA-2, etc.), and public key cryptography (RSA, DSA, Diffie-Hellman key exchange).

In this tutorial, I will show you step by step how to install the latest stable OpenSSL version from source on Ubuntu 22.04 and CentOS 7.6 servers.

What will we do?

  1. Install Dependencies
  2. Download OpenSSL Source Code
  3. Install OpenSSL
    1. Compile and Install OpenSSL
    2. Configure Link Libraries
    3. Configure OpenSSL Binary
  4. Testing

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.

On Ubuntu

Update the Ubuntu repository and install package dependencies for software compilation using the apt command below.

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

On CentOS

Install the 'Development Tools' and some packages libraries using the yum command.

yum group install 'Development Tools'
yum install perl-core zlib-devel -y

After the installation is complete, go to the next step.

Step 2 - Download OpenSSL

In this tutorial, we will install the latest stable version of OpenSSL - OpenSSL 3.0.7. You can download the source code from the OpenSSL site.

Go to the '/usr/local/src' directory and download the OpenSSL source code using wget.

cd /usr/local/src/
wget https://www.openssl.org/source/openssl-3.0.7.tar.gz

Now extract the openssl.tar.gz file, and go to the 'openssl' directory.

tar -xf openssl-3.0.7.tar.gz
cd openssl-3.0.7

How to Install the latest OpenSSL version from Source on Linux (1)

The OpenSSL source code has been downloaded.

Step 3 - Install OpenSSL

Before installing the custom OpenSSL version to the system, let's check the installed version using the command below.

openssl version -a

Below is my results on Ubuntu:

How to Install the latest OpenSSL version from Source on Linux (2)

We will replace version 3.0.2 with latest stable version OpenSSL 3.0.7.

We will install the new OpenSSL version to the specific directory '/usr/local/ssl', and then enable the Link Libraries of OpenSSL, and configure the new binary PATH for OpenSSL.

Install and Compile OpenSSL

Go to the openssl downloaded directory '/usr/local/src/openssl'.

cd /usr/local/src/openssl-3.0.7

Configure and compile OpenSSL with the commands below.

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

make
make test

Wait for the OpenSSL compile process.

How to Install the latest OpenSSL version from Source on Linux (3)

How to Install the latest OpenSSL version from Source on Linux (4)

Note:

  • --prefix and --openssldir = Set the output path of the OpenSSL.
  • shared = force to create a shared library.
  • zlib = enable the compression using zlib library.

When the compile process is complete, install the OpenSSL using the command below.

make install

How to Install the latest OpenSSL version from Source on Linux (5)

OpenSSL is installed in the '/usr/local/ssl' directory.

How to Install the latest OpenSSL version from Source on Linux (6)

Configure Link Libraries

Next, we will configure the shared libraries for OpenSSL. The new OpenSSL binary will load library files from the '/usr/local/ssl/lib' directory.

Go to the '/etc/ld.so.conf.d' directory and create new configuration file 'openssl-3.0.7.conf'.

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

Paste the openssl library path directory.

/usr/local/ssl/lib64

Save and exit.

Now reload the dynamic link using the command below.

sudo ldconfig -v

And you will see the OpenSSL libraries on the '/usr/local/ssl/lib64' directory has been loaded.

Ubuntu:

How to Install the latest OpenSSL version from Source on Linux (7)

Configure OpenSSL Binary

We will replace the default openssl binary '/usr/bin/openssl or /bin/openssl' with the new version '/usr/local/ssl/bin/openssl'.

On Ubuntu 22.04 LTS

Backup the binary files.

mv /usr/bin/c_rehash /usr/bin/c_rehash.bak
mv /usr/bin/openssl /usr/bin/openssl.bak

Edit the '/etc/environment' file using nano.

nano /etc/environment

Now add the new OpenSSL binary directory as below

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

How to Install the latest OpenSSL version from Source on Linux (8)

Save and exit.

Reload the environment file and test the new updated binary PATH.

source /etc/environment
echo $PATH

Now check the OpenSSL binary file again.

which openssl

You will get the result as below.

How to Install the latest OpenSSL version from Source on Linux (9)

The binary path of OpenSSL for Ubuntu has been updated.

On CentOS 7.6

Back up the CentOS OpenSSL binary files.

mv /bin/openssl /bin/openssl.bak

Create new environment files for OpenSSL.

vim /etc/profile.d/openssl.sh

Paste the configuration below.

#Set OPENSSL_PATHOPENSSL_PATH="/usr/local/ssl/bin"export OPENSSL_PATHPATH=$PATH:$OPENSSL_PATHexport PATH

Save and exit.

Make the openssl.sh file executable.

chmod +x /etc/profile.d/openssl.sh

Load the OpenSSL environment and check the PATH bin directory using the commands below.

source /etc/profile.d/openssl.sh
echo $PATH

Now check the OpenSSL file.

which openssl

The binary path forOpenSSLon CentOS has been updated.

Step 4 - Testing

Test the new OpenSSL version using the following command.

openssl version -a

The result on Ubuntu.

How to Install the latest OpenSSL version from Source on Linux (10)

The latest stable version of OpenSSL has been installed from source on Linux Ubuntu 22.04 and CentOS 7.6.

Reference

How to Install the latest OpenSSL version from Source on Linux (2024)
Top Articles
When does a negative cash balance appear on the balance sheet? | AccountingCoach
The Rise of Crypto in the UAE: A Hub for Innovation
Lengua With A Tilde Crossword
13 Easy Ways to Get Level 99 in Every Skill on RuneScape (F2P)
The Daily News Leader from Staunton, Virginia
Chelsea player who left on a free is now worth more than Palmer & Caicedo
CKS is only available in the UK | NICE
Jonathan Freeman : "Double homicide in Rowan County leads to arrest" - Bgrnd Search
What happens if I deposit a bounced check?
Amelia Bissoon Wedding
Mile Split Fl
[Birthday Column] Celebrating Sarada's Birthday on 3/31! Looking Back on the Successor to the Uchiha Legacy Who Dreams of Becoming Hokage! | NARUTO OFFICIAL SITE (NARUTO & BORUTO)
Divina Rapsing
Nurse Logic 2.0 Testing And Remediation Advanced Test
X-Chromosom: Aufbau und Funktion
Curver wasmanden kopen? | Lage prijs
EASYfelt Plafondeiland
Football - 2024/2025 Women’s Super League: Preview, schedule and how to watch
Dcf Training Number
Jeffers Funeral Home Obituaries Greeneville Tennessee
Raw Manga 1000
Troy Gamefarm Prices
Cb2 South Coast Plaza
Copper Pint Chaska
Narragansett Bay Cruising - A Complete Guide: Explore Newport, Providence & More
Login.castlebranch.com
TJ Maxx‘s Top 12 Competitors: An Expert Analysis - Marketing Scoop
Viduthalai Movie Download
Skepticalpickle Leak
Halsted Bus Tracker
Delta Rastrear Vuelo
Beaver Saddle Ark
Poster & 1600 Autocollants créatifs | Activité facile et ludique | Poppik Stickers
Marine Forecast Sandy Hook To Manasquan Inlet
Covalen hiring Ai Annotator - Dutch , Finnish, Japanese , Polish , Swedish in Dublin, County Dublin, Ireland | LinkedIn
The Bold And The Beautiful Recaps Soap Central
Space Marine 2 Error Code 4: Connection Lost [Solved]
Myfxbook Historical Data
Bill Manser Net Worth
Coroner Photos Timothy Treadwell
Despacito Justin Bieber Lyrics
Dr Mayy Deadrick Paradise Valley
Login
Blow Dry Bar Boynton Beach
Hampton In And Suites Near Me
News & Events | Pi Recordings
Lesson 5 Homework 4.5 Answer Key
Freightliner Cascadia Clutch Replacement Cost
What Does the Death Card Mean in Tarot?
Thrift Stores In Burlingame Ca
Shad Base Elevator
Códigos SWIFT/BIC para bancos de USA
Latest Posts
Article information

Author: Ray Christiansen

Last Updated:

Views: 6084

Rating: 4.9 / 5 (69 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Ray Christiansen

Birthday: 1998-05-04

Address: Apt. 814 34339 Sauer Islands, Hirtheville, GA 02446-8771

Phone: +337636892828

Job: Lead Hospitality Designer

Hobby: Urban exploration, Tai chi, Lockpicking, Fashion, Gunsmithing, Pottery, Geocaching

Introduction: My name is Ray Christiansen, I am a fair, good, cute, gentle, vast, glamorous, excited person who loves writing and wants to share my knowledge and understanding with you.