UbuntuUbuntu Based

How To Install OpenSSL on Ubuntu 24.04 LTS

Install OpenSSL on Ubuntu 24.04

In this tutorial, we will show you how to install OpenSSL on Ubuntu 24.04 LTS. OpenSSL is a powerful open-source cryptographic library that provides a robust set of tools for secure communication over computer networks. It is widely used to implement SSL/TLS protocols, which are essential for encrypting sensitive data transmitted between servers and clients.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of OpenSSL on Ubuntu 24.04 (Noble Numbat). You can follow the same instructions for Ubuntu 22.04 and any other Debian-based distribution like Linux Mint, Elementary OS, Pop!_OS, and more as well.

Prerequisites

  • A server running one of the following operating systems: Ubuntu and any other Debian-based distribution like Linux Mint.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies.
  • An Ubuntu 24.04 system with root access or a user with sudo privileges.

Install OpenSSL on Ubuntu 24.04 LTS Noble Numbat

Step 1. Updating the Package Repository.

To install OpenSSL using the APT package manager, you first need to update the repository index. Run the following command in your terminal:

sudo apt update

This command will fetch the latest package information from the Ubuntu repositories, allowing you to install the most recent version of OpenSSL and its dependencies. Updating the package repository is crucial to maintaining the security and stability of your system.

Step 2. Installing Prerequisites.

Before installing OpenSSL from source, you need to install some necessary packages:

sudo apt install build-essential checkinstall zlib1g-dev

Step 2. Installing OpenSSL on Ubuntu 24.04.

  • Method 1: Installing OpenSSL via APT Repository

With the APT repository updated, you can now install OpenSSL by running the following command:

sudo apt install openssl

Once the installation is complete, verify that OpenSSL is properly installed by checking its version:

openssl version

The output should display the installed OpenSSL version, confirming that the installation was successful.

  • Method 2: Installing OpenSSL from Source

Compiling OpenSSL from source allows you to install a specific version or apply custom patches. Follow these steps to install OpenSSL from source on Ubuntu 24.04.

Download the latest stable version of the OpenSSL source code from the official website. At the time of writing, the latest version is 3.3.1. Use the following command to download the source code:

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

Extract the downloaded source code archive using the tar command:

tar -xzvf openssl-3.3.1.tar.gz

Change to the extracted directory and configure the build using the following commands:

cd openssl-3.3.1
./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl

Compile the source code using the make command:

make

Once the compilation is complete, run the following command to test the build:

make test

If all tests pass, install OpenSSL using the following command:

sudo make install

To ensure that your system can find the newly installed OpenSSL libraries, update the library path by creating a new file in the /etc/ld.so.conf.d/ directory:

echo "/usr/local/openssl/lib" | sudo tee -a /etc/ld.so.conf.d/openssl-3.3.1.conf

Then, run the following command to update the dynamic linker cache:

sudo ldconfig -v

Verify the installation by checking the version of the newly installed OpenSSL:

/usr/local/openssl/bin/openssl version -a

The output should display detailed information about the installed OpenSSL version, confirming that the installation from the source was successful.

Step 3. Configuring OpenSSL.

After installing OpenSSL, you may need to configure it to suit your specific needs. The main configuration file for OpenSSL is located at /usr/local/openssl/openssl.cnf. To edit this file, use a text editor with sudo privileges:

sudo nano /usr/local/openssl/openssl.cnf

The configuration file contains various settings for SSL/TLS protocols, cryptographic algorithms, and certificate options. Some common settings you may want to modify include:

  • MinProtocol: Sets the minimum SSL/TLS protocol version to use (e.g., TLSv1.2).
  • CipherString: Specifies the list of allowed cipher suites.
  • SECLEVEL: Determines the security level for cryptographic operations (default is 2).

Be cautious when modifying the OpenSSL configuration file, as incorrect settings can lead to security vulnerabilities or compatibility issues. Always consult the official OpenSSL documentation and best practices before making changes.

After modifying the configuration file, save the changes and exit the text editor. Restart any services that depend on OpenSSL for the changes to take effect.

Congratulations! You have successfully installed OpenSSL. Thanks for using this tutorial for installing OpenSSL on the Ubuntu 24.04 LTS system. For additional help or useful information, we recommend you check the OpenSSL website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button