tengine-2.1.0 源码安装

[root@localhost tengine-2.1.0]# yum update -y
[root@localhost tengine-2.1.0]# yum install gcc gcc-c++ autoconf automake -y

安装需要的组件

PCRE(Perl Compatible Regular Expressions)是一个Perl库,包括 perl 兼容的正则表达式库。nginx rewrite依赖于PCRE库,所以在安装Tengine前一定要先安装PCRE,最新版本的PCRE可在官网(http://www.pcre.org/)获取。具体安装流程为:

[root@ok software]# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz
[root@localhost pcre-8.38]# ./configure --prefix=/usr/local/pcre
[root@localhost pcre-8.38]# make && make install

OpenSSL 是一个强大的安全套接字层密码库,囊括主要的密码算法、常用的密钥和证书封装管理功能及SSL协议,并提供丰富的应用程序供测试或其它目的使用。,安装OpenSSL(http://www.openssl.org/source/)主要是为了让tengine支持Https的访问请求。具体是否安装看需求。

[root@localhost openssl-1.0.2j]# ./config --prefix=/usr/local/openssl
[root@localhost openssl-1.0.2j]# make && make install

Zlib是提供资料压缩之用的函式库,当Tengine想启用GZIP压缩的时候就需要使用到Zlib(http://www.zlib.net/

[root@localhost zlib-1.2.8]# ./configure --prefix=/usr/local/zlib
[root@localhost zlib-1.2.8]# make && make install

jemalloc(http://www.canonware.com/jemalloc/)是一个更好的内存管理工具,使用jemalloc可以更好的优化Tengine的内存管理

[root@localhost jemalloc-3.6.0]# ./configure --prefix=/usr/local/jemalloc
[root@localhost jemalloc-3.6.0]# make && make install

安装Tengine

 添加一个专门的用户来执行Tengine,不建议用root

[root@localhost jemalloc-3.6.0]# groupadd www
[root@localhost jemalloc-3.6.0]# useradd -s /sbin/nologin -g www www
[root@localhost tengine-2.1.0]# ./configure --prefix=/apps/tengine-2.1.0 
>  --user=www 
>  --group=www 
>  --with-pcre=/usr/local/pcre 
>  --with-openssl=/usr/local/openssl 
>  --with-jemalloc=/usr/local/jemalloc 
>  --with-http_realip_module 
>  --with-http_stub_status_module 
>  --with-http_concat_module 
>  --with-zlib=/usr/local/zlib 

注意配置的时候 –with-pcre 、–with-openssl、–with-jemalloc、–with-zlib的路径为源文件的路径(上面是指定的安装路径所以报错)下面改过来,编译成功!后 # make && make install

[root@localhost tengine-2.1.0]# ./configure --prefix=/apps/tengine-2.1.0  --user=www  --group=www  --with-pcre=/usr/local/src/pcre-8.38  --with-openssl=/usr/local/src/openssl-1.0.2j  --with-jemalloc=/usr/local/src/jemalloc-3.6.0  --with-http_realip_module  --with-http_stub_status_module  --with-http_concat_module  --with-zlib=/usr/local/src/zlib-1.2.8
[root@localhost apps]# cd tengine-2.1.0/
[root@localhost tengine-2.1.0]# ls
conf  html  include  logs  modules  sbin
[root@localhost tengine-2.1.0]# cd sbin/
[root@localhost sbin]# ls
dso_tool  nginx
[root@localhost sbin]# ./nginx 
[root@localhost sbin]# pgrep nginx
9632
9633
[root@localhost sbin]# netstat -lnutp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      9632/nginx          
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1959/sshd           
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      2818/master         
tcp        0      0 :::22                       :::*                        LISTEN      1959/sshd           
tcp        0      0 ::1:25                      :::*                        LISTEN      2818/master         
udp        0      0 0.0.0.0:68                  0.0.0.0:*                               1737/dhclient  
原文地址:https://www.cnblogs.com/bass6/p/5933832.html