How to install OpenSSL on Ubuntu!

How to install OpenSSL on Ubuntu!

Written by Adam. R on Sep 14th, 2021 ・ Views ・ Report Post

What is OpenSSL?

OpenSSL is a robust, commercial-grade, and full-featured toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols. It is also a general-purpose cryptography library.


Installing OpenSSL

  1. First, make sure that all your system packages are up-to-date by running the following apt commands in the terminal.
sudo apt update
sudo apt upgrade
  1. InstallOpenSSL on Ubuntu 20.04.
cd /usr/local/src/
wget https://www.openssl.org/source/openssl-1.1.1k.tar.gz
sudo tar -xf openssl-1.1.1k.tar.gz
cd openssl-1.1.1k

Then, we configure and compile OpenSSL:

sudo ./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared zlib
sudo make
sudo make test
sudo make install

Once OpenSSL is installed, it is prudent to link the shared libraries for it so that they load at runtime:

cd /etc/ld.so.conf.d/
sudo nano openssl-1.1.1k.conf

Paste the OpenSSL library path directory:

/usr/local/ssl/lib

Next, reload the dynamic link by issuing the command below:

sudo ldconfig -v
  1. Configuring the OpenSSL binary. Now edit the /etc/environment file using nano editor:
sudo nano /etc/environment

You may use VIM if you like.

Add the following line:

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

Save and close. Next, reload the environment file to bring in the new PATH variable:

To verify the OpenSSL installation and version, you can execute the following command:

source /etc/environment
echo $PATH

openssl version -a

    Your output should be as follows. But it may vary if the package updates to a different version.

OpenSSL 3.0


That’s it, you have successfully installed OpenSSL on your Ubuntu Server and you can start using it!

## If you found this usful then please comment and follow me! Also check out [my website where I also post everything from here](https://howtoubuntu.xyz)

Comments (0)