---
title: 源码编译安装
description: "| 适用的软件版本 | 是否适配CentOS 7.6 | 是否适配CentOS 8.1 | 是否适配openEuler 20.03 LTS SP1 |"
url: https://www.hikunpeng.com/document/detail/zh/kunpengwebs/ecosystemEnable/Tengine/kunpengtengine_02_0011.html
sourcePath: /source/zh/kunpengwebs/ecosystemEnable/Tengine/kunpengtengine_02_0011.html
indexId: 2f73db872c6f386551b68854c99c6920f7be27a08a67aff0240f68fae6df207574
---
# 源码编译安装

| 适用的软件版本 | 是否适配CentOS 7.6 | 是否适配CentOS 8.1 | 是否适配openEuler 20.03 LTS SP1 |
| --- | --- | --- | --- |
| Tengine 2.2.2 | 是 | 否 | 是 |
| Tengine 2.2.3 | 否 | 是 | 否 |


下文命令中的x.x.x代表Tengine的版本号。


1. 获取Tengine源码。

  a. 在本地浏览器下载源码。

    -       Tengine 2.2.2(https://tengine.taobao.org/download/tengine-2.2.2.tar.gz)

    -       Tengine 2.2.3(https://tengine.taobao.org/download/tengine-2.2.3.tar.gz)

  b. 将源码包上传到服务器“/home”目录下。
    若服务器可以访问网络，则通过wget命令直接下载源码。 1 2 cd /home wget https://tengine.taobao.org/download/tengine-x.x.x.tar.gz --no-check-certificate

2. 解压Tengine安装包。
  1 tar -xzvf tengine-x.x.x.tar.gz

3. 进入源码目录。
  1 cd tengine-x.x.x

4. 配置Tengine。

  - Tengine 2.2.2：
    1 ./configure --prefix=/usr/local/tengine-nginx --with-http_ssl_module --with-openssl-async --with-cc-opt="-DNGX_SECURE_MEM -I/usr/local/include -Wno-error=deprecated-declarations" --with-ld-opt="-Wl,-rpath=/usr/local/lib -L/usr/local/lib"

  - Tengine 2.2.3：（使用系统默认OpenSSL因此不需要指定OpenSSL路径。）
    1 ./configure --prefix=/usr/local/tengine-nginx --with-http_ssl_module --with-openssl-async

5. 编译安装Tengine。
  1 make -j60 && make install

  如果提示“src/core/ngx_murmurhash.c:37:11: error: this statement may fall through [-Werror=implicit-fallthrough=]”，请参见执行编译安装Tengine命令时提示ngx_murmurhash.c的解决方法解决。 如果提示“src/os/unix/ngx_user.c:36:7: error: ‘struct crypt_data’ has no member named ‘current_salt’”，请参见执行编译安装Tengine命令时提示ngx_user.c的解决方法解决。

6. 查看安装目录。
  1 ll /usr/local/tengine-nginx

7. 查看版本。
  1 /usr/local/tengine-nginx/sbin/nginx -v
