You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by me...@apache.org on 2021/02/02 02:48:09 UTC

[apisix] branch master updated: chore: sync install-dependencies.md & polish it (#3467)

This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new b033a75  chore: sync install-dependencies.md & polish it (#3467)
b033a75 is described below

commit b033a75b896ae42cf6baffa59d08b817faaba23c
Author: 罗泽轩 <sp...@gmail.com>
AuthorDate: Tue Feb 2 10:47:59 2021 +0800

    chore: sync install-dependencies.md & polish it (#3467)
---
 doc/install-dependencies.md       | 14 +++++---------
 doc/zh-cn/install-dependencies.md | 28 +++++++++++++++++++---------
 utils/centos7-ci.sh               | 13 ++++---------
 utils/linux-install-luarocks.sh   | 14 +++++++++++++-
 utils/linux-install-openresty.sh  |  2 +-
 5 files changed, 42 insertions(+), 29 deletions(-)

diff --git a/doc/install-dependencies.md b/doc/install-dependencies.md
index d132597..145607b 100644
--- a/doc/install-dependencies.md
+++ b/doc/install-dependencies.md
@@ -35,15 +35,13 @@
 
 - If you want use Tengine instead of OpenResty, please take a look at this installation step script [Install Tengine at Ubuntu](../.travis/linux_tengine_runner.sh).
 
-- By default Apache APISIX runs with LuaJIT of OpenResty 1.19 (priority) or Lua 5.1. If you run in to an issue `luajit: lj_asm_x86.h:2819: asm_loop_fixup: Assertion '((intptr_t)target & 15) == 0' failed`, it is caused by to the compatibility of OpenResty version. OpenResty 1.19 is recommended, please take a look at this installation step script [linux-install-openresty](../utils/linux-install-openresty.sh).
+- If it is OpenResty 1.19, APISIX will use OpenResty's built-in LuaJIT to run `bin/apisix`; otherwise it will use Lua 5.1. If you encounter `luajit: lj_asm_x86.h:2819: asm_loop_ fixup: Assertion '((intptr_t)target & 15) == 0' failed`, this is a problem with the low version of OpenResty's built-in LuaJIT under certain compilation conditions.
+
+- - On some platforms, installing LuaRocks via the package manager will cause Lua to be upgraded to Lua 5.3, so we recommend installing LuaRocks via source code. if you install OpenResty and its OpenSSL develop library (openresty-openssl-devel for rpm and openresty-openssl-dev for deb) via the official repository, then [we provide a script for automatic installation](. /... /utils/linux-install-luarocks.sh). If you compile OpenResty yourself, you can refer to the above script and change  [...]
 
 # CentOS 7
 
 ```shell
-# install epel, `luarocks` need it.
-wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
-sudo rpm -ivh epel-release-latest-7.noarch.rpm
-
 # install etcd
 wget https://github.com/etcd-io/etcd/releases/download/v3.4.13/etcd-v3.4.13-linux-amd64.tar.gz
 tar -xvf etcd-v3.4.13-linux-amd64.tar.gz && \
@@ -55,13 +53,11 @@ sudo yum install yum-utils
 sudo yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
 
 # install OpenResty and some compilation tools
-sudo yum install -y openresty curl git gcc lua-devel openresty-openssl-devel
+sudo yum install -y openresty curl git gcc openresty-openssl-devel
 
 # install LuaRocks
 curl https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh -sL | sudo bash -
 
-# configure
-
 # start etcd server
 nohup etcd &
 ```
@@ -80,7 +76,7 @@ tar -xvf etcd-v3.4.13-linux-amd64.tar.gz && \
     sudo cp -a etcd etcdctl /usr/bin/
 
 # install OpenResty and some compilation tools
-sudo yum install -y openresty curl git gcc lua-devel openresty-openssl-devel
+sudo yum install -y openresty curl git gcc openresty-openssl-devel
 
 # install LuaRocks
 curl https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh -sL | sudo bash -
diff --git a/doc/zh-cn/install-dependencies.md b/doc/zh-cn/install-dependencies.md
index 6026c97..2e54d49 100644
--- a/doc/zh-cn/install-dependencies.md
+++ b/doc/zh-cn/install-dependencies.md
@@ -34,15 +34,13 @@
 
 - 如果你要想使用 Tengine 替代 OpenResty,请参考 [Install Tengine at Ubuntu](../../.travis/linux_tengine_runner.sh)。
 
-- Apache APISIX 运行默认使用 OpenResty 1.19 内置的 LuaJIT(优先推荐)或 Lua 5.1。若运行过程中出现问题 `luajit: lj_asm_x86.h:2819: asm_loop_fixup: Assertion '((intptr_t)target & 15) == 0' failed`,是因 OpenResty 版本兼容性问题,建议更换 OpenResty 版本为 1.19,请参考 [linux-install-openresty](../../utils/linux-install-openresty.sh)。
+- 如果是 OpenResty 1.19,APISIX 会使用 OpenResty 内置的 LuaJIT 来运行 `bin/apisix`;否则会使用 Lua 5.1。如果运行过程中遇到 `luajit: lj_asm_x86.h:2819: asm_loop_fixup: Assertion '((intptr_t)target & 15) == 0' failed`,这是低版本 OpenResty 内置的 LuaJIT 在特定编译条件下的问题。
+
+- 在某些平台上,通过包管理器安装 LuaRocks 会导致 Lua 被升级为 Lua 5.3,所以我们建议通过源代码的方式安装 LuaRocks。如果你通过官方仓库安装 OpenResty 和 OpenResty 的 OpenSSL 开发库(rpm 版本:openresty-openssl-devel,deb 版本:openresty-openssl-dev),那么 [我们提供了自动安装的脚本](../../utils/linux-install-luarocks.sh)。如果你是自己编译的 OpenResty,可以参考上述脚本并修改里面的路径。如果编译时没有指定 OpenSSL 库的路径,那么无需配置 LuaRocks 内跟 OpenSSL 相关的变量,因为默认都是用的系统自带的 OpenSSL。如果编译时指定了 OpenSSL 库,那么需要保证 LuaRocks 的 OpenSSL 配置跟 OpenResty 的相一致。
 
 # CentOS 7
 
 ```shell
-# 安装 epel, `luarocks` 需要它
-wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
-sudo rpm -ivh epel-release-latest-7.noarch.rpm
-
 # 安装 etcd
 wget https://github.com/etcd-io/etcd/releases/download/v3.4.13/etcd-v3.4.13-linux-amd64.tar.gz
 tar -xvf etcd-v3.4.13-linux-amd64.tar.gz && \
@@ -54,7 +52,10 @@ sudo yum install yum-utils
 sudo yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
 
 # 安装 OpenResty 和 编译工具
-sudo yum install -y openresty curl git gcc luarocks lua-devel
+sudo yum install -y openresty curl git gcc openresty-openssl-devel
+
+# 安装 LuaRocks
+curl https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh -sL | sudo bash -
 
 # 开启 etcd server
 nohup etcd &
@@ -74,7 +75,10 @@ tar -xvf etcd-v3.4.13-linux-amd64.tar.gz && \
     sudo cp -a etcd etcdctl /usr/bin/
 
 # 安装 OpenResty 和 编译工具
-sudo yum install -y openresty curl git gcc luarocks lua-devel
+sudo yum install -y openresty curl git gcc openresty-openssl-devel
+
+# 安装 LuaRocks
+curl https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh -sL | sudo bash -
 
 # 开启 etcd server
 nohup etcd &
@@ -97,7 +101,10 @@ tar -xvf etcd-v3.4.13-linux-amd64.tar.gz && \
     sudo cp -a etcd etcdctl /usr/bin/
 
 # 安装 OpenResty 和 编译工具
-sudo apt-get install -y git openresty curl luarocks
+sudo apt-get install -y git openresty curl openresty-openssl-dev
+
+# 安装 LuaRocks
+curl https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh -sL | sudo bash -
 
 # 开启 etcd server
 nohup etcd &
@@ -125,7 +132,10 @@ tar -xvf etcd-v3.4.13-linux-amd64.tar.gz && \
     sudo cp -a etcd etcdctl /usr/bin/
 
 # 安装 OpenResty 和 编译工具
-sudo apt-get install -y git openresty curl luarocks
+sudo apt-get install -y git openresty curl make openresty-openssl-dev
+
+# 安装 LuaRocks
+curl https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh -sL | sudo bash -
 
 # 开启 etcd server
 nohup etcd &
diff --git a/utils/centos7-ci.sh b/utils/centos7-ci.sh
index b65a5e5..3dcd12f 100755
--- a/utils/centos7-ci.sh
+++ b/utils/centos7-ci.sh
@@ -25,17 +25,12 @@ install_dependencies() {
     yum install -y wget tar gcc automake autoconf libtool make unzip \
         curl git which sudo
 
-    # install epel and luarocks
-    wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
-    rpm -ivh epel-release-latest-7.noarch.rpm
-    yum install -y lua-devel
-
-    ./apisix/utils/linux-install-luarocks.sh
-
     # install openresty
     yum install -y yum-utils && yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
-    yum install -y openresty-debug
-    yum install -y openresty-openssl-debug-devel
+    yum install -y openresty-debug openresty-openssl-debug-devel
+
+    # install luarocks
+    ./apisix/utils/linux-install-luarocks.sh
 
     # install etcdctl
     wget https://github.com/etcd-io/etcd/releases/download/v3.4.0/etcd-v3.4.0-linux-amd64.tar.gz
diff --git a/utils/linux-install-luarocks.sh b/utils/linux-install-luarocks.sh
index addcc6c..a8ac95c 100755
--- a/utils/linux-install-luarocks.sh
+++ b/utils/linux-install-luarocks.sh
@@ -23,7 +23,19 @@ fi
 wget https://github.com/luarocks/luarocks/archive/v3.4.0.tar.gz
 tar -xf v3.4.0.tar.gz
 cd luarocks-3.4.0 || exit
-./configure --prefix=/usr > build.log 2>&1 || (cat build.log && exit 1)
+
+OR_BIN="$OPENRESTY_PREFIX/bin/openresty"
+OR_VER=$($OR_BIN -v 2>&1 | awk -F '/' '{print $2}' | awk -F '.' '{print $1"."$2}')
+if [[ -e $OR_BIN && "$OR_VER" == 1.19 ]]; then
+    WITH_LUA_OPT="--with-lua=${OPENRESTY_PREFIX}/luajit"
+else
+    # For old version OpenResty, we still need to install LuaRocks with Lua
+    WITH_LUA_OPT=
+fi
+
+./configure --prefix=/usr $WITH_LUA_OPT \
+    > build.log 2>&1 || (cat build.log && exit 1)
+
 make build > build.log 2>&1 || (cat build.log && exit 1)
 make install > build.log 2>&1 || (cat build.log && exit 1)
 cd .. || exit
diff --git a/utils/linux-install-openresty.sh b/utils/linux-install-openresty.sh
index f9d0406..4d4d3bc 100755
--- a/utils/linux-install-openresty.sh
+++ b/utils/linux-install-openresty.sh
@@ -70,7 +70,7 @@ if [ "$OPENRESTY_VERSION" == "source" ]; then
     make
     sudo make install
 
-    sudo apt-get install lua5.1 liblua5.1-0-dev openresty-openssl-debug-dev
+    sudo apt-get install openresty-openssl-debug-dev
     exit 0
 fi