Install OpenSSL 1.1.1k on AlmaLinux 8
Tags: openssl, almalinux, linux, neutroncloud
Published: 2021-08-27 05:25:41

<!-- wp:paragraph -->
<p>In this article, we'll explain how to install OpenSSL 1.1.1k on AlmaLinux 8.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>OpenSSL is a robust, commercial-grade, and full-featured toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols. OpenSSL is a software library for applications that secure communications over computer networks against eavesdropping or need to identify the party at the other end.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>OpenSSL is licensed under an Apache-style license, which means that you are free to get and use it for commercial and non-commercial purposes subject to some simple license conditions. For a list of vulnerabilities, and the releases in which they were found and fixes, see our <a href="https://www.openssl.org/news/vulnerabilities.html" target="_blank" rel="noreferrer noopener">Vulnerabilities</a> page.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4>Prerequisites</h4>
<!-- /wp:heading -->

<!-- wp:list -->
<ul><li>A&nbsp;AlmaLinux 8 installed <a href="https://neutroncloud.in/pricing" target="_blank" rel="noreferrer noopener">cloud instance</a>.</li><li>A root user access or normal user with administrative privileges.</li></ul>
<!-- /wp:list -->

<!-- wp:html -->
<a href="https://neutroncloud.in/docs/install-openssl-1-1-1k-on-almalinux-8/">Install OpenSSL 1.1.1k on AlmaLinux 8</a>
<!-- /wp:html -->

<!-- wp:heading {"level":4} -->
<h4>1. Keep the server up to date</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Always keep the server up to date the security purpose.</p>
<!-- /wp:paragraph -->

<!-- wp:quote -->
<blockquote class="wp-block-quote"><p># dnf update -y</p></blockquote>
<!-- /wp:quote -->

<!-- wp:heading {"level":4} -->
<h4>2. Install development tool</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>We need to install a development tool and few dependencies to install OpenSSL</p>
<!-- /wp:paragraph -->

<!-- wp:quote -->
<blockquote class="wp-block-quote"><p># dnf group install 'Development Tools'</p></blockquote>
<!-- /wp:quote -->

<!-- wp:heading {"level":4} -->
<h4>3. Install dependencies</h4>
<!-- /wp:heading -->

<!-- wp:quote -->
<blockquote class="wp-block-quote"><p># dnf install perl-core zlib-devel  wget -y</p></blockquote>
<!-- /wp:quote -->

<!-- wp:heading {"level":4} -->
<h4>4. Download OpenSSL 1.1.1k</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>We will download the latest stable version is the 1.1.1 series. This is also our Long Term Support (LTS) version, supported until 11th September 2023.</p>
<!-- /wp:paragraph -->

<!-- wp:quote -->
<blockquote class="wp-block-quote"><p># cd /usr/local/src/</p><p># wget https://www.openssl.org/source/openssl-1.1.1k.tar.gz</p></blockquote>
<!-- /wp:quote -->

<!-- wp:paragraph -->
<p>Now, extract the tar file</p>
<!-- /wp:paragraph -->

<!-- wp:quote -->
<blockquote class="wp-block-quote"><p># tar -xzvf openssl-1.1.1k.tar.gz</p></blockquote>
<!-- /wp:quote -->

<!-- wp:heading {"level":4} -->
<h4>5. Configure and build</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Navigate to the extracted directory and configure, build, test and install OpenSSL in the default location /usr/local/ssl.</p>
<!-- /wp:paragraph -->

<!-- wp:quote -->
<blockquote class="wp-block-quote"><p># cd openssl-1.1.1k</p></blockquote>
<!-- /wp:quote -->

<!-- wp:paragraph -->
<p>Configure it with PATH</p>
<!-- /wp:paragraph -->

<!-- wp:quote -->
<blockquote class="wp-block-quote"><p># ./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared zlib</p></blockquote>
<!-- /wp:quote -->

<!-- wp:paragraph -->
<p>Output:</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":538,"sizeSlug":"full","linkDestination":"none"} -->
<figure class="wp-block-image size-full"><img src="https://neutroncloud.in/docs/wp-content/uploads/2021/08/install-OpenSSL.png" alt="install OpenSSL 1.1.1" class="wp-image-538"/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Now, build</p>
<!-- /wp:paragraph -->

<!-- wp:quote -->
<blockquote class="wp-block-quote"><p># make</p><p># make test</p><p># make install</p></blockquote>
<!-- /wp:quote -->

<!-- wp:heading {"level":4} -->
<h4>6. Configure it shared libraries.</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Once we have successfully installed OpenSSL, configure it shared libraries.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Naviagate to the /etc/ld.so.conf.d directory and create a configuration file.</p>
<!-- /wp:paragraph -->

<!-- wp:quote -->
<blockquote class="wp-block-quote"><p># cd /etc/ld.so.conf.d/</p><p># vi openssl-1.1.1k.conf</p></blockquote>
<!-- /wp:quote -->

<!-- wp:paragraph -->
<p>Add the following path in the config file</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code><p>/usr/local/ssl/lib</p></code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>Save and exit</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Reload the dynamic link</p>
<!-- /wp:paragraph -->

<!-- wp:quote -->
<blockquote class="wp-block-quote"><p># ldconfig -v</p></blockquote>
<!-- /wp:quote -->

<!-- wp:heading {"level":4} -->
<h4>7. Configure OpenSSL Binary</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Now, we are going to insert the binary of our new version of OpenSSL /usr/local/ssl/bin/openssl and replace the default openssl file.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>First, take a backup of existed openssl file.</p>
<!-- /wp:paragraph -->

<!-- wp:quote -->
<blockquote class="wp-block-quote"><p># mv /bin/openssl /bin/openssl.backup</p></blockquote>
<!-- /wp:quote -->

<!-- wp:paragraph -->
<p>Create new environment files for OpenSSL</p>
<!-- /wp:paragraph -->

<!-- wp:quote -->
<blockquote class="wp-block-quote"><p># vi /etc/profile.d/openssl.sh</p></blockquote>
<!-- /wp:quote -->

<!-- wp:paragraph -->
<p>and add the following lines</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code><p>OPENSSL_PATH="/usr/local/ssl/bin"
export OPENSSL_PATH
PATH=$PATH:$OPENSSL_PATH
export PATH</p></code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>Save &amp; exit</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Make the newly created file executable</p>
<!-- /wp:paragraph -->

<!-- wp:quote -->
<blockquote class="wp-block-quote"><p># chmod +x /etc/profile.d/openssl.sh</p></blockquote>
<!-- /wp:quote -->

<!-- wp:paragraph -->
<p>Reload the new OpenSSL environment file and check the default PATH</p>
<!-- /wp:paragraph -->

<!-- wp:quote -->
<blockquote class="wp-block-quote"><p># source /etc/profile.d/openssl.sh<br># echo $PATH</p></blockquote>
<!-- /wp:quote -->

<!-- wp:paragraph -->
<p>Now, let's verify the installation and version of the OpenSSL</p>
<!-- /wp:paragraph -->

<!-- wp:quote -->
<blockquote class="wp-block-quote"><p># which openssl<br># openssl version -a</p></blockquote>
<!-- /wp:quote -->

<!-- wp:paragraph -->
<p>Output will be similar like:</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>OpenSSL 1.1.1k  25 Mar 2021
built on: Thu Aug 19 06:33:43 2021 UTC
platform: linux-x86_64
options:  bn(64,64) rc4(16x,int) des(int) idea(int) blowfish(ptr) 
compiler: gcc -fPIC -pthread -m64 -Wa,--noexecstack -Wall -O3 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DAESNI_ASM -DVPAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -DZLIB -DNDEBUG
OPENSSLDIR: "/usr/local/ssl"
ENGINESDIR: "/usr/local/ssl/lib/engines-1.1"
Seeding source: os-specific</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>That's it, the installation has been completed successfully.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>In this article, we’ve learned how to install OpenSSL 1.1.1k on AlmaLinux 8.</p>
<!-- /wp:paragraph -->