centos7.6环境下编译安装tengine-2.2.2的编译安装

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 -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

make && 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
make
sudo 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 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.2'
make: *** [build] Error 2


解决方案:
打开nginx源文件下的/usr/local/src/tengine-2.2.2/auto/lib/openssl/conf文件:
找到这么一段代码:
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报错:
make[2]: *** No rule to make target `distclean'.  Stop
make[2]: *** [/usr/local/lab/zlib-1.2.11/libz.a] Error 2

问题分析:
/usr/local/lab/zlib-1.2.11/下没有libz.a文件,当时编译的时候是--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,-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


# 报错

    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源文件下的/usr/local/src/tengine-2.2.2/auto/lib/openssl/conf文件:
找到这么一段代码:
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的编译安装即可

 

posted @ 2018-12-26 20:14 reblue520 阅读( ...) 评论( ...) 编辑 收藏

你可能感兴趣的:(centos7.6环境下编译安装tengine-2.2.2的编译安装)