Best Guide to Install OpenSSL 3 on Ubuntu 20.04 – OrcaCore
In this comprehensive guide, you will learn how to Install OpenSSL 3 on Ubuntu 20.04. OpenSSL is a versatile cryptography library that provides an open-source implementation of the TLS protocol. It empowers users to execute a wide array of SSL-related operations, encompassing CSR (Certificate Signing Request) generation, private key creation, and seamless SSL certificate installation.
The default OpenSSL version on Ubuntu 20.04 (V1.1) is often outdated, leading to compilation errors for applications requiring a newer release. Therefore, this guide from Orcacore demonstrates how to install the latest version of OpenSSL 3 on Ubuntu 20.04.
To successfully follow this guide, you must be logged into your Ubuntu 20.04 server as a non-root user with sudo privileges. If you need assistance with this, refer to our guide on Initial Server Setup with Ubuntu 20.04.
You can also view the video tutorial for OpenSSL 3 setup on Ubuntu 20.04:
1. Set up OpenSSL 3 Ubuntu 20.04
Begin by updating your local package index using the following command:
sudo apt update
Next, install the necessary dependencies for OpenSSL 3 with the command below:
sudo apt install build-essential checkinstall zlib1g-dev -y
2. Download OpenSSL From Source
Now, visit the GitHub OpenSSL Releases page and download the latest release using the wget command:
sudo wget https://github.com/openssl/openssl/releases/download/openssl-3.0.8/openssl-3.0.8.tar.gz
Then, extract the downloaded file:
sudo tar xvf openssl-3.0.8.tar.gz
Navigate to the extracted OpenSSL directory:
cd openssl-3.0*/
3. Build and Install OpenSSL 3 on Ubuntu 20.04
Configure OpenSSL 3:
./config

Build and install OpenSSL 3.0:
# make
# make test
# make install
Update links and caches:
sudo ldconfig
Update your system-wide OpenSSL configuration:
sudo tee /etc/profile.d/openssl.sh<<EOF
export PATH=/usr/local/openssl/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/openssl/lib:$LD_LIBRARY_PATH
EOF
Reload the shell environment:
source /etc/profile.d/openssl.sh
Verify your OpenSSL 3 installation on Ubuntu 20.04 by checking its version:
openssl version

Conclusion
This guide has walked you through the steps to Install OpenSSL 3 on Ubuntu 20.04. OpenSSL 3 on Ubuntu 20.04 provides updated features, enhanced security, and improved performance compared to previous versions.
I hope this was helpful. You might also find these articles interesting:
Install Brotli Compression on Ubuntu 20.04
Install Ntopng on Ubuntu 20.04
Bitwarden Password Manager Ubuntu 20.04
Siege HTTP load testing tool Ubuntu 20.04
Nagios Monitoring Tool For Ubuntu 20.04
Apache Kafka Setup on Ubuntu 20.04
Alternative Solutions for Installing OpenSSL 3 on Ubuntu 20.04
While the above method of compiling from source is a reliable way to get the latest OpenSSL 3 version, it requires manual management and updates. Here are two alternative approaches:
1. Using a Third-Party Repository (e.g., Ondřej Surý’s PPA)
A more convenient approach is to utilize a Personal Package Archive (PPA). PPAs are software repositories for Ubuntu that are often used to distribute more recent versions of software than those available in the official Ubuntu repositories. Ondřej Surý’s PPA is a well-known and trusted source for updated packages, including PHP and related libraries. While it doesn’t directly offer OpenSSL, the dependencies required to run newer PHP versions may include newer OpenSSL libraries, or could be adapted to include them with some effort. This method offers easier installation and updates managed by apt
. However, using a third-party repository comes with the risk of potential instability and security vulnerabilities, so it should be done with caution. It’s crucial to research the PPA maintainer and understand the risks before adding it to your system.
Caveat: It’s important to note that directly installing OpenSSL via Ondřej Surý’s PPA is not the primary purpose of the PPA. This method relies on the PPA providing updated dependencies that happen to include a newer OpenSSL. It’s not a guaranteed method, and it’s subject to change as the PPA maintainer updates their packages.
Steps (Conceptual – Requires PPA Adaptation):
-
Add the PPA (Example): This is a placeholder, as the PPA might not directly offer OpenSSL. The PPA would need to be modified to include an OpenSSL package, which is beyond the scope of a simple guide.
sudo add-apt-repository ppa:ondrej/php # Example - DO NOT USE DIRECTLY FOR OpenSSL
-
Update Package Lists:
sudo apt update
-
Attempt to Install OpenSSL (Likely Won’t Work Directly):
sudo apt install openssl # Likely installs the default version
Instead, you would likely need to install a package from the PPA that depends on a newer OpenSSL version. This requires investigation of the PPA’s packages.
-
Verify the OpenSSL Version:
openssl version
Explanation:
This method leverages the apt
package manager to install OpenSSL 3. By adding a PPA, you’re instructing apt
to look for packages in that repository in addition to the standard Ubuntu repositories. The apt update
command refreshes the package lists to include the packages available in the newly added PPA. Then, apt install openssl
attempts to install the OpenSSL package from the PPA. Important: This is highly dependent on the PPA actually providing an OpenSSL package or a package that pulls in a newer version as a dependency. If the PPA doesn’t offer a newer OpenSSL, this method will simply install the default Ubuntu version.
Code Example (Conceptual and Potentially Non-Functional):
This example demonstrates the idea of using a PPA. It is unlikely to work directly without significant modifications to the PPA.
# DANGER: This is for demonstration purposes only. DO NOT run this directly
# without understanding the risks and verifying that the PPA contains a suitable OpenSSL package.
sudo add-apt-repository ppa:example/openssl-updates # Replace with a REAL PPA
sudo apt update
sudo apt install openssl
openssl version
2. Using Docker
Another approach is to use Docker. Docker allows you to run applications in isolated containers, which can include specific versions of software like OpenSSL 3. This ensures that your application uses the desired version without affecting the system-wide OpenSSL installation.
Steps:
-
Install Docker: If you don’t have Docker installed, follow the official Docker installation instructions for Ubuntu.
-
Create a Dockerfile: Create a file named
Dockerfile
in your project directory with the following content:FROM ubuntu:20.04 RUN apt-get update && apt-get install -y --no-install-recommends build-essential zlib1g-dev # Download, extract, build, and install OpenSSL 3 RUN wget https://github.com/openssl/openssl/releases/download/openssl-3.0.8/openssl-3.0.8.tar.gz && tar xvf openssl-3.0.8.tar.gz && cd openssl-3.0.8 && ./config && make && make install && ldconfig ENV PATH="/usr/local/openssl/bin:${PATH}" ENV LD_LIBRARY_PATH="/usr/local/openssl/lib:${LD_LIBRARY_PATH}" # Your application setup here (e.g., copy your application code) WORKDIR /app COPY . /app # Example command to run your application CMD ["/bin/bash"]
-
Build the Docker Image: In the same directory as the
Dockerfile
, run the following command to build the Docker image:docker build -t my-openssl-app .
-
Run the Docker Container: Run the Docker container with the following command:
docker run -it my-openssl-app
This will start a bash shell inside the container. You can then verify the OpenSSL version:
openssl version
Explanation:
The Dockerfile defines the environment for your application. It starts with a base Ubuntu 20.04 image. It then installs the necessary build tools and dependencies for compiling OpenSSL 3. It downloads, extracts, builds, and installs OpenSSL from source, similar to the original guide. Finally, it sets the PATH
and LD_LIBRARY_PATH
environment variables to ensure that the application uses the newly installed OpenSSL version. The COPY . /app
line copies your application code into the container, and the CMD
line specifies the command to run when the container starts.
Code Example (Dockerfile):
FROM ubuntu:20.04
RUN apt-get update && apt-get install -y --no-install-recommends
build-essential
zlib1g-dev
# Download, extract, build, and install OpenSSL 3
RUN wget https://github.com/openssl/openssl/releases/download/openssl-3.0.8/openssl-3.0.8.tar.gz &&
tar xvf openssl-3.0.8.tar.gz &&
cd openssl-3.0.8 &&
./config &&
make &&
make install &&
ldconfig
ENV PATH="/usr/local/openssl/bin:${PATH}"
ENV LD_LIBRARY_PATH="/usr/local/openssl/lib:${LD_LIBRARY_PATH}"
# Your application setup here (e.g., copy your application code)
WORKDIR /app
COPY . /app
# Example command to run your application
CMD ["/bin/bash"]
These alternative solutions offer different approaches to installing OpenSSL 3 on Ubuntu 20.04, each with its own advantages and disadvantages. The Docker approach provides isolation and reproducibility, while the PPA method offers easier updates. Choose the method that best suits your needs and technical expertise. Remember to carefully consider the risks associated with using third-party repositories before proceeding.