Ubuntu 源码安装Kong

安装openresty

1.下载openssl-1.0.2h

tar xzvf openssl-1.0.2h.tar.gz

2.下载openresty

官方安装指引:https://openresty.org/cn/installation.html

以下是我个人安装流程

tar xzvf openresty-1.9.15.1.tar.gz

安装openresty前需要先 准备对应的库有: perl 5.6.1+, libreadline, libpcre, libssl

如果为ubuntu用户则

apt-get install libreadline-dev libncurses5-dev libpcre3-dev \
    libssl-dev perl make build-essential

下载完毕后进入目录

./configure  \
--prefix=/opt/openresty \
--with-openssl=../openssl-1.0.2h \
--with-pcre-jit   \
--with-ipv6   \
--with-http_realip_module   \
--with-http_ssl_module   \
--with-http_stub_status_module

其中 --prefix=/opt/openresty 为安装目录

make
make install
$ export PATH="/opt/openresty/bin:/opt/openresty/nginx/sbin:$PATH"
nginx -v

nginx version: openresty/1.9.15.1

表示成功安装

安装luarocks

luarocks为lua的包管理工具

1.克隆源码

git clone https://github.com/keplerproject/luarocks.git

2.配置、编译、安装

./configure \
  --lua-suffix=jit \
  --with-lua=/opt/openresty/luajit \
  --with-lua-include=/opt/openresty/luajit/include/luajit-2.1

make

make install

安装serf v0.7

下载地址 https://www.serf.io/downloads.html

解压后移到 /usr/local/bin 或者 /usr/bin 目录下

安装 Kong

1.克隆源码并安装

$ git clone https://github.com/Mashape/kong
$ git checkout next
$ luarocks make
$ cd bin
$ sudo cp kong /usr/local/bin

2.修改配置文件

在源码的根目录下有个 kong.conf.default 文件,修改里面对应的配置使其满足你的需要。

运行 Kong

KONG_DATABASE=postgres kong start -c /etc/kong/kong.conf

你可能感兴趣的:(Ubuntu 源码安装Kong)