centos下kong源码安装

参考资料:

https://docs.konghq.com/install/source/

环境准备:操作系统 centeros7.3

             1 :openssl和pcre一般系统自带,如果没有可自己安装 https://www.openssl.org/source/

               或者 yum -y install pcre-devel openssl openssl-devel

              2: git

                yum install git -y

              3:gcc

                yum install gcc -y

               3: lua

      wget http://luajit.org/download/LuaJIT-2.0.5.tar.gz

            tar -xvf LuaJIT-2.0.5.tar.gz

                  cd LuaJIT-2.0.5

                  make install

一: 下载安装 openresty

    wget https://openresty.org/download/openresty-1.13.6.2.tar.gz

   tar -xvf openresty-1.13.6.2.tar.gz

   cd openresty-1.13.6.2

   ./configure  --with-pcre-jit --with-http_ssl_module  --with-http_realip_module --with-http_stub_status_module  --with-http_v2_module

    gmake install

二:luarocks 

     wget http://luarocks.github.io/luarocks/releases/luarocks-3.0.3.tar.gz

      tar -xvf luarocks-3.0.3.tar.gz

      cd luarocks-3.0.3

       ./configure

      make install

三:安装kong 

       将源码copy到服务器

       make install

       如果成功会提示:kong 0.14.1-0 is now installed in /usr/local (license: MIT)

四 :安装数据库

    yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm -y

    yum install postgresql10 -y

    yum install postgresql10-server -y

    /usr/pgsql-10/bin/postgresql-10-setup initdb

    systemctl enable postgresql-10

     systemctl start postgresql-10

   创建数据库

su - postgres
psql
CREATE USER kong; CREATE DATABASE kong OWNER kong;
\q
exit;

还需要设置下数据库访问权限
vi /var/lib/pgsql/10/data/pg_hba.conf
修改为:host    all             all             127.0.0.1/32            trust
systemctl restart postgresql-10

五:kong启动

在 /etc/kong/ 文件创建kong.conf 内容如下

prefix = /usr/data/kong/
proxy_listen = 0.0.0.0:8000, 0.0.0.0:8443 ssl
admin_listen = 127.0.0.1:8001
database = postgres # Determines which of PostgreSQL or Cassandra

pg_host = 127.0.0.1 # The PostgreSQL host to connect to.
pg_port = 5432 # The port to connect to.
pg_user = kong # The username to authenticate if required.
pg_password = # The password to authenticate if required.
pg_database = kong

在kong源码根目录
bin/kong migrations up
bin/kong start
检查配置:
curl -i -X GET http://localhost:8001/

安装完毕。

六: kong dashboard
yum install -y nodejs
npm install -g kong-dashboard
nohup kong-dashboard start --kong-url http://0.0.0.0:8001 --basic-auth admin=123456 &

转载于:https://www.cnblogs.com/hssy/p/9715926.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值