避免权限问题,测试环境全部使用的是
root用户操作
1.安装 openresty
wget https://openresty.org/download/openresty-1.15.8.2.tar.gz
获取openresty源码。
./configure \
--with-pcre-jit \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_stub_status_module \
--with-http_v2_module
make
make install
# openresty 加入到path
export PATH="$PATH:/usr/local/openresty/bin"
openresty 安装完成。
2.安装 luarocks
wget https://luarocks.org/releases/luarocks-3.2.1.tar.gz
获取 luarocks。
./configure --with-lua=/usr/local/openresty/luajit/ \
--lua-suffix=jit \
--with-lua-include=/usr/local/openresty/luajit/include/luajit-2.1
make build
make install
需指定 --with-lua 使用
openresty的luajit 存在版本差异,openresty使用的lua版本为5.1。有一个底层库依赖bitOp不支持现在的5.3版本
3.下载kong 代码
git clone git@github.com:Kong/kong.git
获取 kong 代码
make install
完成kong 的安装。
遇到的问题
lua版本问题,在安装luarocks时 未指定--with-lua和--with-lua-include最后在执行kong的make install出现版本冲突。无法继续下去。-
系统基础库依赖问题,在安装
lyaml依赖的时候出现了Error: Failed installing dependency: https://luarocks.org/lyaml-6.2.4-1.src.rock - Could not find library file for YAML No file libyaml.a in /usr/local/lib No file libyaml.a in /usr/local/lib64 No file libyaml.so in /usr/local/lib No file libyaml.so in /usr/local/lib64 No file matching libyaml.so.* in /usr/local/lib No file matching libyaml.so.* in /usr/local/lib64 No file libyaml.a in /usr/lib No file libyaml.a in /usr/lib64 No file libyaml.so in /usr/lib No file libyaml.so in /usr/lib64 No file matching libyaml.so.* in /usr/lib No file matching libyaml.so.* in /usr/lib64 No file libyaml.a in /lib No file libyaml.a in /lib64 No file libyaml.so in /lib No file libyaml.so in /lib64 No file matching libyaml.so.* in /lib No file matching libyaml.so.* in /lib64 You may have to install YAML in your system and/or pass YAML_DIR or YAML_LIBDIR to the luarocks command.错误,在
centos系统上安装了libyaml和libyaml-devel后,再执行kong的make install。
kong 1.4.0-0 is now installed in /usr/local (license: Apache 2.0)
安装完成。
我的博客即将同步至腾讯云+社区,邀请大家一同入驻:https://cloud.tencent.com/developer/support-plan?invite_code=1suums4p513oq