How to Install the latest OpenSSL version from Source on Linux
How to Install the latest OpenSSL version from Source on Linux
Log in or Sign up
Search...
Tutorial search
Home How to Install the latest OpenSSL version from Source on Linux
Ad Scan your Web-Server for Malware with ISPProtect now. Get Free Trial.
OpenSSL is a widely used crypto library that implements SSL On this page
and TLS protocols for secure communication over computer
networks. OpenSSL is used by many programs like Apache What we will do?
Web server, PHP, Postfix and many others. OpenSSL provides Step 1 - Install Dependencies
support for various cryptographic algorithms such as ciphers On Ubuntu
(AES, Blowfish, DES, IDEA etc.), cryptographic hash functions On CentOS
(MD5, MD4, SHA-1, SHA-2 etc.) and public key cryptography Step 2 - Download OpenSSL
(RSA, DSA, Diffie-Hellman key exchange). Step 3 - Install OpenSSL
Install and Compile OpenSSL
Configure Link Libraries
In this tutorial, I will show you step by step how to install the
Configure OpenSSL Binary
latest stable OpenSSL version from source on Ubuntu 18.04 Step 4 - Testing
and CentOS 7.6 servers. Reference
https://www.howtoforge.com/tutorial/how-to-install-openssl-from-source-on-linux/ 1/19
7/21/2019 How to Install the latest OpenSSL version from Source on Linux
The first step, before we can compile the OpenSSL library from source, 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.
On CentOS
Install the 'Development Tools' and some packages libraries using the yum command.
In this tutorial, we will install the latest stable version of OpenSSL - OpenSSL 1.0.2o. 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-1.0.2o.tar.gz
https://www.howtoforge.com/tutorial/how-to-install-openssl-from-source-on-linux/ 3/19
7/21/2019 How to Install the latest OpenSSL version from Source on Linux
Before installing the custom OpenSSL version to the system, let's check the installed version using the command below.
openssl version -a
We will replace the '1.1.0g' version with the latest stable version 1.0.2o.
https://www.howtoforge.com/tutorial/how-to-install-openssl-from-source-on-linux/ 4/19
7/21/2019 How to Install the latest OpenSSL version from Source on Linux
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.
cd /usr/local/src/openssl-1.0.2o
make
make test
Note:
When the compile process is complete, install the OpenSSL using the command below.
make install
https://www.howtoforge.com/tutorial/how-to-install-openssl-from-source-on-linux/ 5/19
7/21/2019 How to Install the latest OpenSSL version from Source on Linux
Next, we will configure the shared libraries for OpenSSL. The new OpenSSL binary will load library files from the
'/usr/local/ssl/lib' directory.
cd /etc/ld.so.conf.d/
vim openssl-1.0.2o.conf
/usr/local/ssl/lib
sudo ldconfig -v
And you will see the OpenSSL libraries on the '/usr/local/ssl/lib' directory has been loaded.
Ubuntu:
https://www.howtoforge.com/tutorial/how-to-install-openssl-from-source-on-linux/ 7/19
7/21/2019 How to Install the latest OpenSSL version from Source on Linux
CentOS:
We will replace the default openssl binary '/usr/bin/openssl or /bin/openssl' with the new version '/usr/local/ssl/bin/openssl'.
https://www.howtoforge.com/tutorial/how-to-install-openssl-from-source-on-linux/ 8/19
7/21/2019 How to Install the latest OpenSSL version from Source on Linux
mv /usr/bin/c_rehash /usr/bin/c_rehash.BEKUP
mv /usr/bin/openssl /usr/bin/openssl.BEKUP
vim /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/game
s:/usr/local/ssl/bin"
Reload the environment file and test the new updated binary PATH.
source /etc/environment
echo $PATH
which openssl
https://www.howtoforge.com/tutorial/how-to-install-openssl-from-source-on-linux/ 9/19
7/21/2019 How to Install the latest OpenSSL version from Source on Linux
On CentOS 7.6
mv /bin/openssl /bin/openssl.BEKUP
vim /etc/profile.d/openssl.sh
https://www.howtoforge.com/tutorial/how-to-install-openssl-from-source-on-linux/ 10/19
7/21/2019 How to Install the latest OpenSSL version from Source on Linux
#Set OPENSSL_PATH
OPENSSL_PATH="/usr/local/ssl/bin"
export OPENSSL_PATH
PATH=$PATH:$OPENSSL_PATH
export PATH
chmod +x /etc/profile.d/openssl.sh
Load the OpenSSL environment and check the PATH bin directory using commands below.
source /etc/profile.d/openssl.sh
echo $PATH
which openssl
https://www.howtoforge.com/tutorial/how-to-install-openssl-from-source-on-linux/ 11/19
7/21/2019 How to Install the latest OpenSSL version from Source on Linux
Step 4 - Testing
openssl version -a
https://www.howtoforge.com/tutorial/how-to-install-openssl-from-source-on-linux/ 12/19
7/21/2019 How to Install the latest OpenSSL version from Source on Linux
Result on CentOS.
The new latest stable version of OpenSSL has been installed from source on Linux Ubuntu 18.04 and CentOS 7.5.
Reference
https://wiki.openssl.org/
Muhammad Arul is a freelance system administrator and technical writer. He is working with Linux Environments for more
than 5 years, an Open Source enthusiast and highly motivated on Linux installation and troubleshooting. Mostly working
with RedHat/CentOS Linux and Ubuntu/Debian, Nginx and Apache web server, Proxmox, Zimbra Administration, and
Website Optimization. Currently learning about OpenStack and Container Technology.