CentOS   发布时间:2022-04-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了centos7.6环境下编译安装tengine-2.2.2的编译安装大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

centos7.6环境下编译安装tENGIne-2.2.2的编译安装 1.获取tENGIne2.2.2的源码包 http://tENGIne.taobao.org/download/tENGIne-2.2.2.tar.gz 2.获取tENGIne的编译参数 /usr/loca/nginx/sbin/nginx -V # tENGIne2.2.2的编译安装 tar -zx
centos7.6环境下编译安装tENGIne-2.2.2的编译安装

1.获取tENGIne2.2.2的源码包
http://tENGIne.taobao.org/download/tENGIne-2.2.2.tar.gz

2.获取tENGIne的编译参数
/usr/loca/Nginx/sbin/Nginx -V

# tENGIne2.2.2的编译安装

tar -zxf tENGIne-2.2.2.tar.gz
cd tENGIne-2.2.2
./configure --prefix=/usr/local/tENGIne-2.2.2 --with-ld-opt=-Wl,-rpath,--user=daemon --group=daemon --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_sub_module --with-http_stub_status_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-http_geoip_module --with-http_secure_link_module --with-http_degradation_module --with-mail_ssl_module --with-http_sysguard_module --with-http_concat_module --with-pcre=/usr/local/lab/pcre-8.34 --with-zlib=/usr/local/lab/zlib-1.2.11 --add-module=/usr/local/lab/ngx_cache_purge-2.3 --with-jemalloc --with-http_upstream_check_module --with-http_lua_module --with-luajit-lib=/usr/local/lib/ --with-luajit-inc=/usr/local/include/luajit-2.0/ --with-lua-inc=/usr/local/include/luajit-2.0/ --with-lua-lib=/usr/local/lib/ --with-openssl=/usr/local/lab/openssl-1.1.0i --add-module=/usr/local/ngx_http_geoip2_module-3.2

@H_442_44@make && @H_442_44@make install

# 因为openssl经常曝出一些大的漏洞,使用最新版本的openssl1.1.0i
--with-openssl=/usr/local/lab/openssl-1.1.0i

# 找到geoip相关的库

ngx_http_geoip2_module-3.2

....


报错的处理:

问题1:./configure预编译报错
configuring additional modules
adding module in /usr/local/lab/ngx_cache_purge-2.3
 + ngx_http_cache_purge_module was configured
adding module in /usr/local/ngx_http_geoip2_module-3.2
checking for maxmindDB library ... found
 + ngx_geoip2_module was configured
adding module in modules/ngx_http_lua_module
checking for LuaJIT library in /usr/local/lib/ and /usr/local/include/luajit-2.0/ (specified by the LUAJIT_LIB and LUAJIT_INC env,with -ldl) ... found
checking for export symbols by default (-E) ... found
checking for export symbols by default (--export-all-symbols) ... not found
checking for SO_PASSCRED ... found
 + ngx_http_lua_module was configured
checking for libxslt ... found
checking for libexslt ... found
checking for GeoIP library ... not found
checking for GeoIP library in /usr/local/ ... not found
checking for GeoIP library in /usr/pkg/ ... not found
checking for GeoIP library in /opt/local/ ... not found

./configure: error: the GeoIP module requires the GeoIP library.
You can either do not enable the module or install the library.

解决办法编译安装GeoIP:
cd source
wget https://github.com/maxmind/geoip-api-c/releases/download/v1.6.9/GeoIP-1.6.9.tar.gz
tar -zxvf GeoIP-1.6.9.tar.gz -C /usr/local
cd GeoIP-1.6.9
# 注意不要添加--prefix 认即可否则无法正常编译安装
./configure
@H_442_44@make
sudo @H_442_44@make install

问题2:
make编译报错:
    POSIX mem threshold ............. : 10
    Internal link size .............. : 2
    nested parentheses limit ........ : 250
    Match limit ..................... : 10000000
    Match limit recursion ........... : MATCH_LIMIT
    Build shared libs ............... : no
    Build static libs ............... : yes
    Use JIT in pcregrep ............. : no
    Buffer size for pcregrep ........ : 20480
    Link pcregrep with libz ......... : no
    Link pcregrep with libbz2 ....... : no
    Link pcretest with libedit ...... : no
    Link pcretest with libreadline .. : no
    Valgrind support ................ : no
    Code coverage ................... : no

cd /usr/local/lab/openssl-1.1.0i     && if [ -f Makefile ]; then @H_442_44@make clean; fi     && ./config --prefix=/usr/local/lab/openssl-1.1.0i/.openssl no-shared      && @H_442_44@make     && @H_442_44@make install LIBDIR=lib
/bin/sh: line 2: ./config: No such file or directory
@H_442_44@make[1]: *** [/usr/local/lab/openssl-1.1.0i/.openssl/include/openssl/ssl.h] Error 127
@H_442_44@make[1]: Leaving directory `/usr/local/src/tENGIne-2.2.2@H_442_44@make: *** [build] Error 2


解决方案:
打开Nginx源@L_673_21@下的/usr/local/src/tENGIne-2.2.2/auto/lib/openssl/conf@L_673_21@:
找到这么一段代码:
CORE_INCS="$CORE_INCS $OPENSSL/.openssl/include"
CORE_DEPS="$CORE_DEPS $OPENSSL/.openssl/include/openssl/ssl.h"
CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libssl.a"
CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libcrypto.a"
CORE_LIBS="$CORE_LIBS $NGX_LIBDL"
修改成以下代码:
CORE_INCS="$CORE_INCS $OPENSSL/include"
CORE_DEPS="$CORE_DEPS $OPENSSL/include/openssl/ssl.h"
CORE_LIBS="$CORE_LIBS $OPENSSL/lib/libssl.a"
CORE_LIBS="$CORE_LIBS $OPENSSL/lib/libcrypto.a"
CORE_LIBS="$CORE_LIBS $NGX_LIBDL"
 然后再进行Nginx的编译安装即可


问题3:
make报错:
@H_442_44@make[2]: *** No rule to @H_442_44@make target `distclean.  Stop
@H_442_44@make[2]: *** [/usr/local/lab/zlib-1.2.11/libz.a] Error 2

问题分析:
/usr/local/lab/zlib-1.2.11/下没有libz.a@L_673_21@,当时编译的时候是--prefix的,源码没有拷贝过来

解决办法:
将之前的编译目录拷贝过去即可:
cp -ar /usr/loca/src/zlib-1.2.11/* /usr/local/lab/zlib-1.2.11/


#####################################

tENGIne升级为2.2.3

# tENGIne2.2.3的编译安装

tar -zxf tENGIne-2.2.3.tar.gz
cd tENGIne-2.2.3
./configure --prefix=/usr/local/tENGIne-2.2.3 --with-ld-opt=-Wl,--user=daemon --group=daemon --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_sub_module --with-http_stub_status_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-http_geoip_module --with-http_secure_link_module --with-http_degradation_module --with-mail_ssl_module --with-http_sysguard_module --with-http_concat_module --with-pcre=/usr/local/lab/pcre-8.34 --with-zlib=/usr/local/lab/zlib-1.2.11 --add-module=/usr/local/lab/ngx_cache_purge-2.3 --with-jemalloc --with-http_upstream_check_module --with-http_lua_module --with-luajit-lib=/usr/local/lib/ --with-luajit-inc=/usr/local/include/luajit-2.0/ --with-lua-inc=/usr/local/include/luajit-2.0/ --with-lua-lib=/usr/local/lib/ --with-openssl=/usr/local/lab/openssl-1.1.0i --add-module=/usr/local/ngx_http_geoip2_module-3.2


# 报错

    Use JIT in pcregrep ............. : no
    Buffer size for pcregrep ........ : 20480
    Link pcregrep with libz ......... : no
    Link pcregrep with libbz2 ....... : no
    Link pcretest with libedit ...... : no
    Link pcretest with libreadline .. : no
    Valgrind support ................ : no
    Code coverage ................... : no

cd /usr/local/lab/openssl-1.1.0i     && if [ -f Makefile ]; then make clean; fi     && ./config --prefix=/usr/local/lab/openssl-1.1.0i/.openssl no-shared      && make     && make install LIBDIR=lib
/bin/sh: line 2: ./config: No such file or directory
make[1]: *** [/usr/local/lab/openssl-1.1.0i/.openssl/include/openssl/ssl.h] Error 127
make[1]: Leaving directory `/usr/local/src/tENGIne-2.2.3‘
make: *** [build] Error 2


解决方案:
打开Nginx源@L_673_21@下的/usr/local/src/tENGIne-2.2.2/auto/lib/openssl/conf@L_673_21@:
找到这么一段代码:
CORE_INCS="$CORE_INCS $OPENSSL/.openssl/include"
CORE_DEPS="$CORE_DEPS $OPENSSL/.openssl/include/openssl/ssl.h"
CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libssl.a"
CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libcrypto.a"
CORE_LIBS="$CORE_LIBS $NGX_LIBDL"
修改成以下代码:
CORE_INCS="$CORE_INCS $OPENSSL/include"
CORE_DEPS="$CORE_DEPS $OPENSSL/include/openssl/ssl.h"
CORE_LIBS="$CORE_LIBS $OPENSSL/lib/libssl.a"
CORE_LIBS="$CORE_LIBS $OPENSSL/lib/libcrypto.a"
CORE_LIBS="$CORE_LIBS $NGX_LIBDL"
 然后再进行Nginx的编译安装即可
@H_675_442@

大佬总结

以上是大佬教程为你收集整理的centos7.6环境下编译安装tengine-2.2.2的编译安装全部内容,希望文章能够帮你解决centos7.6环境下编译安装tengine-2.2.2的编译安装所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。