This article will show you how you can install the latest version of OpenSSL on your Raspberry Pi system.
How to Update OpenSSL on Raspberry Pi
The Raspberry Pi system, by default, includes the OpenSSL version “1.1.1”, an outdated version of this library. You can confirm the version of OpenSSL through the following command:
The latest version of OpenSSL at the time of writing this article is “3.0.7”, which includes much better security updates and enhanced features. To update your current OpenSSL version to the latest one, follow the below-mentioned steps:
Step 1: Install Dependencies
Before beginning the installation, install some dependencies for OpenSSL through the following command:
Step 2: Change the Location
Next, change your location to “/usr/local/src” through the following command because, at this location, we are going to perform the OpenSSL installation.
Step 3: Download OpenSSL Latest Version Source File
Go to the website to download OpenSSL latest version source file. You can use the wget command for downloading it on Raspberry Pi, as given below.
Step 4: Extract Content of OpenSSL Source File
To extract the contents of the OpenSSL source file, use the following command:
You can use the “ls” command to check for the directory name where the files are extracted.
Step 5: Navigate to OpenSSL Directory
Use the following command to navigate to the OpenSSL directory:
Step 6: Configure OpenSSL
Before installation, you must configure OpenSSL from the following command:
The above command sets up the path for OpenSSL, creates a shared library and enables compression using the zlib library.
Step 7: Compile the OpenSSL Files
Now, use the following command to compile the files required for installing OpenSSL on your Raspberry Pi system:
Step 8: Install OpenSSL
After the compilation, you can then install OpenSSL on Raspberry Pi through the following command:
Step 9: Configure Shared Libraries for OpenSSL
OpenSSL loads the binary files from the location “/usr/local/ssl/lib” and you have to configure this path. First, navigate to the following directory:
Create a configuration file through the nano editor using the following command:
Append the following location inside the file.
Save this file using “CTRL+X” and then reload the changes through the following command:
Step 10: Replace the Default OpenSSL Libraries
You must replace the previous default OpenSSL libraries with the new ones, but before that, you must create the files backup by running the following commands one by one.
$ sudo mv /usr/bin/c_rehash /usr/bin/c_rehash.BEKUP
Afterward, you have to edit the /etc/environment file:
Inside the file, paste the following text:
local/games:/usr/local/ssl/bin"
Save the file and then load the changes using the following command:
You can test the path through the following command:
Once this is done, you can use the following command to ensure that OpenSSL is successfully updated on your Raspberry Pi system.
Conclusion
OpenSSL is a cryptographic library used for secure communication over networks. Though it’s already installed on the Raspberry Pi system, you can update its version by following the above-mentioned steps. These steps require installing dependencies, changing the location, downloading the source file, and setting up the environment.