How to Install OpenSSL 3 on AlmaLinux 9 and RockyLinux 9

18 Min Read

Introduction to Install OpenSSL 3

OpenSSL 3 represents a significant advancement in the realm of cryptographic applications, offering a range of enhanced features and improved performance metrics. As a critical library for securing communications over networks, OpenSSL’s latest iteration brings with it a suite of new algorithms and security measures designed to meet the evolving demands of modern computing environments. For users of AlmaLinux 9 and RockyLinux 9, installing OpenSSL 3 is a strategic move that ensures robust security and optimal performance for their systems.

One of the primary benefits of OpenSSL 3 is its improved security architecture. This version includes more stringent validation checks, better protection against side-channel attacks, and enhanced cryptographic algorithms. Additionally, OpenSSL 3 introduces support for the latest protocols and encryption standards, which are essential for maintaining secure communications in contemporary applications.

Performance enhancements are another key feature of OpenSSL 3. The library has been optimized for faster cryptographic operations, reducing the computational overhead and improving the overall responsiveness of applications that rely on secure communications. This makes it particularly advantageous for high-performance environments where speed and security are paramount.

Moreover, OpenSSL 3 comes with a host of new algorithms, including support for post-quantum cryptographic mechanisms. This forward-looking approach ensures that systems are prepared for future advancements in cryptographic technologies, providing a longer-term security solution for users of AlmaLinux 9 and RockyLinux 9.

Before embarking on the installation of OpenSSL 3, it is essential to meet certain prerequisites. These typically include ensuring that your system is up to date with the latest patches and dependencies. The general steps involved in the installation process are straightforward and include downloading the OpenSSL 3 source code, configuring the build environment, compiling the code, and finally, installing the library. Each of these steps will be detailed in the subsequent sections of this guide.

By understanding the importance and benefits of OpenSSL 3, AlmaLinux 9 and RockyLinux 9 users can make informed decisions about upgrading their cryptographic libraries, thereby enhancing the security and performance of their systems.

Prerequisites

Before proceeding with the installation of OpenSSL 3 on AlmaLinux 9 or RockyLinux 9, it is crucial to ensure that your system meets certain prerequisites. These prerequisites include system requirements, necessary packages, and dependencies that must be installed beforehand.

Firstly, you should verify that your system is updated. Running an updated system ensures that you have the latest security patches and software enhancements. To update your system, execute the following command:

sudo dnf update -y

Next, install essential development tools. These tools are necessary for compiling and building software from source. The Development Tools group includes a range of packages that will facilitate the installation process of OpenSSL 3. Use the following command to install them:

sudo dnf groupinstall "Development Tools" -y

Additionally, OpenSSL 3 requires some specific libraries and packages. Ensure that the following packages are installed on your system:

sudo dnf install perl coreutils

These packages will provide essential utilities and perl scripts needed during the installation process.

To compile and build OpenSSL 3 from source, you will also need the ‘wget’ tool to download the source files. Install ‘wget’ by running:

sudo dnf install wget -y

It is important to have root or sudo privileges to perform these installations. Having the necessary administrative privileges allows you to make changes to system files and install packages globally. If you are not logged in as the root user, prepend ‘sudo’ to the commands to execute them with elevated privileges.

Ensuring that these prerequisites are met will provide a smooth installation process for OpenSSL 3 on your AlmaLinux 9 or RockyLinux 9 system.

Downloading OpenSSL 3 Source Code

To install OpenSSL 3 on AlmaLinux 9 or RockyLinux 9, the first step is downloading the OpenSSL 3 source code. This ensures that you have the latest stable version directly from the official source. Begin by navigating to the official OpenSSL website. Open your web browser and go to https://www.openssl.org/source/. This page lists the available versions of OpenSSL, along with their corresponding tarball files.

Locate the latest stable version, which is typically highlighted or marked as recommended. Click on the link to the tarball file to initiate the download. The file usually has a .tar.gz extension, indicating it is a compressed tarball. Save this file to a directory where you can easily access it later.

For users who prefer using the terminal or command line interface, downloading the source code can be more efficient with the wget command. Open your terminal and navigate to the desired directory using cd commands. Once in the correct directory, execute the following command to download the latest OpenSSL 3 tarball:

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

Ensure that you replace openssl-3.0.0.tar.gz with the actual filename of the latest version, which you can find on the OpenSSL source page. This command will download the tarball directly to your current directory.

After downloading, verify the integrity of the downloaded file to ensure it has not been tampered with. The verification process typically involves comparing checksums provided on the OpenSSL website with the checksum of your downloaded file. Use the sha256sum command in the terminal:

sha256sum openssl-3.0.0.tar.gz

Compare the output with the checksum listed on the OpenSSL website. If they match, you have successfully downloaded the OpenSSL 3 source code, and you can proceed to the next steps of the installation process.

Once you have successfully downloaded the OpenSSL 3 tarball file, the next step involves extracting the source code. This process is crucial as it allows you to access the files necessary for the installation. To begin, navigate to the directory where the tarball file is located. Typically, this can be done using the `cd` command. For instance:

cd /path/to/downloaded/file

Before proceeding with the extraction, it is highly recommended to verify the integrity of the downloaded tarball. This step ensures that the file has not been corrupted or tampered with. You can achieve this by using checksums or GPG signatures. OpenSSL often provides checksums (like SHA256) on their official website. To verify the checksum, you can use the following command:

sha256sum openssl-3.x.x.tar.gz

Compare the output with the checksum provided on the OpenSSL website. If they match, it means the file is intact. Alternatively, if a GPG signature is available, you can verify it using:

gpg --verify openssl-3.x.x.tar.gz.asc openssl-3.x.x.tar.gz

After verifying the integrity, you can proceed to extract the tarball. Use the `tar` command to unpack the tarball:

tar -xzf openssl-3.x.x.tar.gz

This command will extract the contents of the tarball into a directory named after the tarball file, minus the extension. Navigate to this newly created directory:

cd openssl-3.x.x

You are now in the directory containing the OpenSSL 3 source code. This directory holds all the necessary files and scripts required for the subsequent steps of the installation process on AlmaLinux 9 or RockyLinux 9.

Configuring the build environment for OpenSSL 3 on AlmaLinux 9 or RockyLinux 9 is a crucial step that ensures the software is tailored to meet your specific needs. This process involves the use of the ./config script, which allows you to set up various configuration options before compiling the source code. The ./config script simplifies the configuration by automatically detecting and setting the appropriate options for your system.

To begin, navigate to the directory where the OpenSSL source code is located. Here, you will execute the ./config script. This script accepts a range of flags and options that enable you to customize the installation. For instance, you can specify the installation directories using the --prefix option. This is useful if you want to install OpenSSL in a non-default location. An example of this command is:

./config --prefix=/usr/local/openssl

Additionally, the --openssldir option can be used to define the directory for OpenSSL configuration files:

./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl/ssl

OpenSSL 3 offers various features that can be enabled or disabled through the ./config script. Commonly used flags include no-ssl2, no-ssl3, and no-comp, which respectively disable support for SSLv2, SSLv3, and compression. This hardening is particularly useful for enhancing security:

./config no-ssl2 no-ssl3 no-comp

For performance optimization, you may choose to enable hardware acceleration by specifying the enable-ec_nistp_64_gcc_128 flag. This flag optimizes the elliptic curve operations, which can be beneficial for applications that require high-performance cryptographic operations:

./config no-ssl2 no-ssl3 no-comp enable-ec_nistp_64_gcc_128

After running the ./config script with your preferred options, it is advisable to review the configuration summary to ensure all settings are as expected. This step concludes the configuration of the build environment, preparing you for the next phase of compiling and installing OpenSSL 3 on your AlmaLinux 9 or RockyLinux 9 system.

Compiling and Installing OpenSSL 3

To compile and install OpenSSL 3 from the source code on AlmaLinux 9 or RockyLinux 9, you need to follow a series of steps to ensure the software is built and installed correctly. Begin by downloading the OpenSSL source code from the official website. Once downloaded, extract the tarball to prepare for compilation.

First, open a terminal and navigate to the directory where you have downloaded the OpenSSL tarball. Extract it using the command:

tar -xvf openssl-3.x.x.tar.gz

Next, navigate into the extracted directory:

cd openssl-3.x.x

Before proceeding with the build, configure the build environment to specify the installation path. You can do this with the following command:

./config --prefix=/usr/local/openssl-3

Once the configuration is complete, you can compile the source code using the make command. This process may take some time, depending on your system’s performance:

sudo make

After the build process is completed, it is crucial to run the test suite to ensure everything is functioning correctly. Execute the following command to run the tests:

sudo make test

If all tests pass successfully, you can proceed with the installation of OpenSSL 3. Use the following command to install the compiled software:

sudo make install

This command will install OpenSSL 3 to the specified prefix directory. To make the newly installed OpenSSL version available system-wide, update your system’s library path and binary path by adding the following lines to your shell profile (e.g., ~/.bashrc or ~/.zshrc):

export PATH=/usr/local/openssl-3/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/openssl-3/lib:$LD_LIBRARY_PATH

After updating your profile, reload it using:

source ~/.bashrc
#or
source ~/.zshrc

By following these steps, you will have successfully compiled and installed OpenSSL 3 on your AlmaLinux 9 or RockyLinux 9 system.

Verifying the Installation

After successfully installing OpenSSL 3 on your AlmaLinux 9 or RockyLinux 9 system, it is crucial to verify that the installation has been executed correctly. To ensure the integrity and functionality of OpenSSL 3, you can perform several checks.

First, you need to confirm the version of OpenSSL installed on your system. Open your terminal and execute the following command:

openssl version

This command should return a response similar to:

3.0.8 7 Feb 2023

If the version number is 3.0.0 or higher, this indicates that OpenSSL 3 has been installed successfully. If the output does not reflect the correct version, you may need to revisit the installation steps.

Next, verify the installation path to ensure that your system is referencing the correct OpenSSL binary. Use the command:

which openssl

This should return a path, typically something like:

/usr/local/bin/openssl

Confirm that this path aligns with the location where you installed OpenSSL 3. If the path points to a different version, you might need to adjust your system’s PATH variable.

To further verify that OpenSSL 3 is fully functional, you can execute a few common OpenSSL commands:

openssl enc -aes-256-cbc -e -in test.txt -out test.enc

This command encrypts the file test.txt using AES-256-CBC encryption. If the command runs without errors, it signifies that the encryption capabilities of OpenSSL 3 are operational.

Another useful command to try is generating a private key:

openssl genpkey -algorithm RSA -out private.key

Successfully generating a private key confirms that the cryptographic functions of OpenSSL 3 are working properly.

By conducting these verification steps, you can confidently ascertain that OpenSSL 3 has been installed and configured correctly on your AlmaLinux 9 or RockyLinux 9 system, ensuring its readiness for secure communications and cryptographic operations.

Post-Installation Configuration

After successfully installing OpenSSL 3 on AlmaLinux 9 or RockyLinux 9, several post-installation configuration steps are essential to ensure the system fully utilizes the new version. These steps involve updating system links, configuring environment variables, and confirming that other applications and services are using the updated OpenSSL libraries.

Firstly, it is crucial to update the system links to point to the newly installed OpenSSL 3. This can be done by creating symbolic links in the `/usr/bin` directory. Use the following command to establish these links:

ln -sf /usr/local/ssl/bin/openssl /usr/bin/openssl

Next, update the library path to include the new OpenSSL libraries. This can be achieved by adding the following lines to the `/etc/ld.so.conf.d/openssl-3.conf` file:

/usr/local/ssl/lib

After saving the file, run ldconfig to update the library cache.

Additionally, configuring environment variables is necessary to ensure the system recognizes the new OpenSSL installation. Add the following lines to your shell profile (e.g., `.bashrc`, `.zshrc`):

export PATH=/usr/local/ssl/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/ssl/lib:$LD_LIBRARY_PATH

Reload the profile using the command source ~/.bashrc (or the appropriate profile file).

Ensuring other applications and services utilize the updated OpenSSL libraries is the final step. This might require modifying configuration files of individual applications to specify the new OpenSSL paths. Check the documentation for each application to determine the necessary changes.

Troubleshooting common issues may involve verifying the OpenSSL version in use. Run openssl version to confirm it displays OpenSSL 3. If not, recheck the symbolic links and environment variables. Additionally, inspect the output of ldd on executables to ensure they link against the correct OpenSSL libraries.

By following these steps, you can ensure a smooth transition to OpenSSL 3 on your AlmaLinux 9 or RockyLinux 9 system, enhancing security and performance across your applications and services.

Conclusion

In this guide, we have provided a detailed walkthrough on how to install OpenSSL 3 on AlmaLinux 9 and RockyLinux 9. By upgrading to OpenSSL 3, users can take advantage of enhanced security features, improved performance, and support for the latest cryptographic standards. This upgrade is essential for maintaining robust security protocols and ensuring compatibility with modern applications and services.

As you integrate OpenSSL 3 into your cryptographic workflows, you will benefit from its advanced capabilities, including better encryption algorithms, support for TLS 1.3, and overall improved efficiency. This upgrade not only fortifies your security infrastructure but also paves the way for more secure and efficient communications.

Leave a comment