Linux-CentOS环境下Nginx源码编译安装产生错误缺失PCRE、OpenSSL、zlib库的问题解决
程序员文章站
2022-06-04 12:31:24
...
Linux-CentOS环境下Nginx源码编译安装产生错误缺失PCRE、OpenSSL、zlib库的问题解决
在
nginx
源码编译安装时,可能会碰到缺失 PCRE
、 OpenSSL
、 zlib
库的错误。解决方法很简单,实际上,该模块也可以去官网获取文件然后进行源码编译。但这里,我们一切从简, CentOS 环境 解决如下 :
[[email protected] nginx-1.16.1]$ :<<!
先用 yum 查找 'PCRE' 库,知道存在包 `pcre-devel.x86_64` 需要安装
!
[[email protected] nginx-1.16.1]$ yum search PCRE
已加载插件:fastestmirror, langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
* webtatic: us-east.repo.webtatic.com
============================================ N/S matched: PCRE ============================================
pcre-devel.i686 : Development files for pcre
pcre-devel.x86_64 : Development files for pcre
pcre-static.i686 : Static library for pcre
pcre-static.x86_64 : Static library for pcre
pcre-tools.x86_64 : Auxiliary utilities for pcre
pcre2-devel.i686 : Development files for pcre2
pcre2-devel.x86_64 : Development files for pcre2
pcre2-static.i686 : Static library for pcre2
pcre2-static.x86_64 : Static library for pcre2
pcre2-tools.x86_64 : Auxiliary utilities for pcre2
pcre2-utf16.i686 : UTF-16 variant of PCRE2
pcre2-utf16.x86_64 : UTF-16 variant of PCRE2
pcre2-utf32.i686 : UTF-32 variant of PCRE2
pcre2-utf32.x86_64 : UTF-32 variant of PCRE2
pcre.i686 : Perl-compatible regular expression library
pcre.x86_64 : Perl-compatible regular expression library
pcre2.i686 : Perl-compatible regular expression library
pcre2.x86_64 : Perl-compatible regular expression library
名称和简介匹配 only,使用“search all”试试。
[[email protected] nginx-1.16.1]$ :<<!
先用 yum 查找 'OpenSSL' 库,知道存在包 `openssl-devel.x86_64` 需要安装
!
[[email protected] nginx-1.16.1]$ yum search OpenSSL
已加载插件:fastestmirror, langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
* webtatic: us-east.repo.webtatic.com
========================================== N/S matched: OpenSSL ===========================================
apr-util-openssl.x86_64 : APR utility library OpenSSL crytpo support
openssl-devel.i686 : Files for development of applications which will use OpenSSL
openssl-devel.x86_64 : Files for development of applications which will use OpenSSL
openssl-perl.x86_64 : Perl scripts provided with OpenSSL
openssl-static.i686 : Libraries for static linking of applications which will use OpenSSL
openssl-static.x86_64 : Libraries for static linking of applications which will use OpenSSL
perl-Crypt-OpenSSL-Bignum.x86_64 : Perl interface to OpenSSL for Bignum
perl-Crypt-OpenSSL-RSA.x86_64 : Perl interface to OpenSSL for RSA
perl-Crypt-OpenSSL-Random.x86_64 : Perl interface to OpenSSL for Random
pyOpenSSL.x86_64 : Python wrapper module around the OpenSSL library
pyOpenSSL-doc.noarch : Documentation for pyOpenSSL
xmlsec1-openssl.i686 : OpenSSL crypto plugin for XML Security Library
xmlsec1-openssl.x86_64 : OpenSSL crypto plugin for XML Security Library
xmlsec1-openssl-devel.i686 : OpenSSL crypto plugin for XML Security Library
xmlsec1-openssl-devel.x86_64 : OpenSSL crypto plugin for XML Security Library
m2crypto.x86_64 : Support for using OpenSSL in python scripts
nss_compat_ossl.i686 : Source-level compatibility library for OpenSSL to NSS porting
nss_compat_ossl.x86_64 : Source-level compatibility library for OpenSSL to NSS porting
openssl.x86_64 : Utilities from the general purpose cryptography library with TLS implementation
openssl-libs.i686 : A general purpose cryptography library with TLS implementation
openssl-libs.x86_64 : A general purpose cryptography library with TLS implementation
openssl098e.i686 : A compatibility version of a general cryptography and TLS library
openssl098e.x86_64 : A compatibility version of a general cryptography and TLS library
perl-Crypt-SSLeay.x86_64 : Crypt::SSLeay - OpenSSL glue that provides LWP https support
perl-Net-SSLeay.x86_64 : Perl extension for using OpenSSL
qca-ossl.i686 : OpenSSL plugin for the Qt Cryptographic Architecture v2
qca-ossl.x86_64 : OpenSSL plugin for the Qt Cryptographic Architecture v2
名称和简介匹配 only,使用“search all”试试。
[[email protected] nginx-1.16.1]$ :<<!
先用 yum 查找 'zlib' 库,知道存在包 `zlib-devel.x86_64` 需要安装
!
[[email protected] nginx-1.16.1]$ yum search zlib
已加载插件:fastestmirror, langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
* webtatic: us-east.repo.webtatic.com
============================================ N/S matched: zlib ============================================
jzlib.noarch : Re-implementation of zlib in pure Java
jzlib-demo.noarch : Examples for jzlib
jzlib-javadoc.noarch : API documentation for jzlib
perl-Compress-Raw-Zlib.x86_64 : Low-level interface to the zlib compression library
perl-IO-Zlib.noarch : Perl IO:: style interface to Compress::Zlib
zlib-devel.i686 : Header files and libraries for Zlib development
zlib-devel.x86_64 : Header files and libraries for Zlib development
zlib-static.i686 : Static libraries for Zlib development
zlib-static.x86_64 : Static libraries for Zlib development
zlib.i686 : The compression and decompression library
zlib.x86_64 : The compression and decompression library
名称和简介匹配 only,使用“search all”试试。
[[email protected] nginx-1.16.1]$ # 安装 pcre-devel.x86_64 库
[[email protected] nginx-1.16.1]$ sudo yum install -y pcre-devel.x86_64
[[email protected] nginx-1.16.1]$ # 安装 openssl-devel.x86_64 库
[[email protected] nginx-1.16.1]$ sudo yum install -y openssl-devel.x86_64
[[email protected] nginx-1.16.1]$ # 安装 zlib-devel.x86_64 库
[[email protected] nginx-1.16.1]$ sudo yum install -y zlib-devel.x86_64
这样就解决了该问题,只需要重新编译 nginx 即可。
这里顺便补充一下,nginx 还可能报缺失其他库的错误。这些缺失库的问题处理都大同小异。 除了去官方下载源码进行编译之外,也可以通过依赖包软件管理器进行对应的库安装。 我们这里采用的办法就是第二种,更简便。这样就可以解决这种问题。
上一篇: 前端学习-如何在title中添加图片
下一篇: Linux如何安装pcre