Upgrading OpenSSL
To prevent dependency problems during the installation and improve system security, upgrade OpenSSL to 1.1.1a or later.
- The built-in OpenSSL versions of CentOS 8.1, openEuler 20.03, and openEuler 22.03 are later than 1.1.1a. Therefore, you do not need to upgrade OpenSSL. Skip this section.
- The built-in OpenSSL version of CentOS 7.6 is 1.0.2k-fips. You need to upgrade OpenSSL.
Check the OpenSSL version.
openssl version
- If Nginx is installed by compiling the source code, select Upgrading OpenSSL (Installing Nginx by Compiling Source Code).
- If Nginx is installed using the RPM package of the mirror site, select Upgrading OpenSSL (Installing Nginx Using the RPM Package of the Mirror Site).
Upgrading OpenSSL (Installing Nginx by Compiling Source Code)
- Obtain the OpenSSL source code.
- Download the OpenSSL source package using the local browser.
Download address: https://codeload.github.com/openssl/openssl/tar.gz/OpenSSL_1_1_1a
- Upload the source package to the /home directory on the server.
If the server is connected to the Internet, you can run the wget command on the server to download the source code.
- Go to the /home directory and download the source package.
1 2
cd /home wget https://codeload.github.com/openssl/openssl/tar.gz/OpenSSL_1_1_1a --no-check-certificate
- Rename the downloaded source package.
The name of the OpenSSL source package downloaded using a local browser is different from that downloaded using the wget command. In this section, the OpenSSL source package is obtained by using a local browser. If you obtain it using the wget command, rename the downloaded source package.
1mv OpenSSL_1_1_1a openssl-OpenSSL_1_1_1a.tar.gz
- Go to the /home directory and download the source package.
- Download the OpenSSL source package using the local browser.
- Decompress the OpenSSL source package.
1tar -xvf openssl-OpenSSL_1_1_1a.tar.gz

- Go to the openssl-OpenSSL_1_1_1a directory and run the ls command to query the files in the directory.
1 2
cd openssl-OpenSSL_1_1_1a/ ls

- Configure OpenSSL.
1./config

- Perform the compilation and installation.
1make -j60 && make -j60 install
The -j 60 parameter takes full advantage of multi-core CPUs to speed up compilation. The number following the -j parameter indicates the number of CPU cores. You can run the lscpu command to view the number of CPU cores.
- Configure the ld.so.conf file.
1 2
echo "/usr/local/lib/" >> /etc/ld.so.conf ldconfig -v
- Make OpenSSL take effect.
- Add OpenSSL to the environment variables.
1echo export PATH=/usr/local/bin:\$PATH >> /etc/profile
- Make the environment variables take effect.
1source /etc/profile
- Add OpenSSL to the environment variables.
- View the OpenSSL version.
- Method 1:
1 2
hash -r openssl version
- Method 2:
1 2 3
hash -r which openssl /usr/local/bin/openssl version
- Method 1:
- View the OpenSSL installation directory.
1openssl version -a
In the command output, the path following OPENSSLDIR is the OpenSSL installation directory.
- Optional: To uninstall OpenSSL installed in the current mode, use the following commands in either of the methods:
- Method 1:
1 2 3 4 5
cd /home/openssl-OpenSSL_1_1_1a make uninstall hash -r openssl version openssl version -a
- Method 2:
1 2 3 4 5 6 7
openssl version -a rm -rf /usr/local/ssl rm -rf /usr/local/lib/engines-1.1 rm -rf /usr/local/bin/openssl hash -r openssl version openssl version -a
- Method 1:
Upgrading OpenSSL (Installing Nginx Using the RPM Package of the Mirror Site)
- Obtain the OpenSSL RPM package.
- Download the RPM package using a local browser.
https://mirrors.huaweicloud.com/kunpeng/yum/el/7/aarch64/Packages/web/openssl-libs-1.1.1a-3.el7.aarch64.rpm
https://mirrors.huaweicloud.com/kunpeng/yum/el/7/aarch64/Packages/web/openssl-1.1.1a-3.el7.aarch64.rpm
https://mirrors.huaweicloud.com/kunpeng/yum/el/7/aarch64/Packages/web/openssl-devel-1.1.1a-3.el7.aarch64.rpm
- Copy the RPM package to the /home directory on the server.
If the server is connected to the Internet, you can run the wget command on the server to download the RPM package.
1 2 3 4
cd /home wget https://mirrors.huaweicloud.com/kunpeng/yum/el/7/aarch64/Packages/web/openssl-libs-1.1.1a-3.el7.aarch64.rpm --no-check-certificate wget https://mirrors.huaweicloud.com/kunpeng/yum/el/7/aarch64/Packages/web/openssl-1.1.1a-3.el7.aarch64.rpm --no-check-certificate wget https://mirrors.huaweicloud.com/kunpeng/yum/el/7/aarch64/Packages/web/openssl-devel-1.1.1a-3.el7.aarch64.rpm --no-check-certificate
- Download the RPM package using a local browser.
- Install OpenSSL.
1rpm -ivh openssl-libs-1.1.1a-3.el7.aarch64.rpm openssl-1.1.1a-3.el7.aarch64.rpm openssl-devel-1.1.1a-3.el7.aarch64.rpm --force --nodeps
- Configure the ld.so.conf file.
1 2
echo "/usr/local/lib/" >> /etc/ld.so.conf ldconfig -v
- Make OpenSSL take effect.
1 2
echo export PATH=/usr/local/bin:\$PATH >> /etc/profile source /etc/profile

- View the OpenSSL version.
- Method 1:
1 2
hash -r openssl version
- Method 2:
1 2 3
hash -r which openssl /usr/local/bin/openssl version
- Method 1:
- View the OpenSSL installation directory.
1openssl version -a
In the command output, the path following OPENSSLDIR is the OpenSSL installation directory.
- Optional: To uninstall OpenSSL, run the following command:
1 2 3 4 5 6
rpm -qa | grep openssl rpm -e --nodeps openssl-devel-1.1.1a openssl-1.1.1a openssl-libs-1.1.1a rpm -qa | grep openssl hash -r openssl version openssl version -a