源码安装kong 0.14版本
源码安装kong 0.14
环境准备:操作系统 centeros7.4
环境准备
openssl
openssl和pcre一般系统自带 或者手动安装yum -y install pcre-devel openssl openssl-devel
git
yum install git -y
gcc
yum install gcc -y
lua
1 | wget http://luajit.org/download/LuaJIT-2.0.5.tar.gz |
安装 openresty
wget https://openresty.org/download/openresty-1.13.6.2.tar.gz
tar -xvf openresty-1.13.6.2.tar.gz
不整合sm2加密
1 | cd openresty-1.13.6.2 |
整合sm2加密
整合sm2后的openresty安装kong有问题,待解决
下载沃通sm2包
1 | wotrus_ssl.tar.gz |
发现报错
/bin/sh: line 2: ./config: No such file or directory
gmake[2]: *** [/root/route_workspace/wotrus_ssl/.openssl/include/openssl/ssl.h] Error 127
修改root/route_workspace/openresty-1.13.6.2/bundle/nginx-1.13.6/auto/lib/openssl/conf 文件
1 | CORE_INCS="$CORE_INCS $OPENSSL/include" |
重新安装
1 | cd openresty-1.13.6.2 |
验证/usr/local/openresty/nginx/sbin/nginx -v
nginx version: openresty/1.13.6.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
built with WoTrusSSL 1.1.0g - OpenSSL 1.1.0d-fips 18 Jan 2020
TLS SNI support enabled
export PATH=”$PATH:/usr/local/openresty/bin”
安装 luarocks
1 | yum install unzip |
安装docker
1 | yum install -y yum-utils device-mapper-persistent-data lvm2 |
修改阿里docker源
sudo mkdir -p /etc/docker
vi /etc/docker/daemon.json
{
“registry-mirrors”: [“https://7sr79bgb.mirror.aliyuncs.com"]
}
sudo systemctl daemon-reload
sudo systemctl restart docker
docker安装postgres数据库
docker run -d –name kong-database
-p 5432:5432
-e “POSTGRES_USER=kong”
-e “POSTGRES_DB=kong”
-e “POSTGRES_PASSWORD=123456”
postgres:9.6
获取kong源码
https://github.com/Kong/kong/releases 获取0.14版本kong源码
安装kong
安装kong 0.14源码
跳转到kong源码目录 进行make安装
cd kong
make install
如果成功会提示:kong 0.14.1-0 is now installed in /usr/local (license: MIT)
启动kong
export PATH=”$PATH:/usr/local/openresty/bin”
在 /etc/kong/ 文件创建kong.conf 内容如下
1 | # kong 安装目录 |
启动
bin/kong migrations up –v
bin/kong start –v
检查配置:
curl -i -X GET http://localhost:8001/