kong1.0安装

1.安装依赖

yum install -y gcc gcc-c++
yum install -y pcre pcre-devel
yum install -y zlib zlib-devel

2.#openssl安装

#openssl 是一个安全套接字层密码库,囊括主要的密码算法、常用的密钥和证书封装管理功能及 SSL 协议

yum install -y openssl openssl-devel

3.安装postgres10

  1. Install the repository RPM:
    yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm
  2. 安装postgresql10-contrib和postgresql10-server。
    yum install postgresql10-contrib postgresql10-server -y

     

  3.  

    修改默认数据目录

    Postgresql默认的数据目录是/var/lib/pgsql/版本号/data目录,这要求你在/var下有足够的存储空间,我们这里将其换掉,假设/home的空间很大。

    首先在/home下创建一个Postgresql的数据目录,指定所有者postgres同时分配权限

    mkdir /home/postgresql
    chown postgres:postgres /home/postgresql
    chmod 750 /home/postgresql

     

    设置环境变量:

    export PATH=/usr/pgsql-10/bin:$PATH
    export LD_LIBRARY_PATH=/usr/pgsql-10/lib
    export PGDATA=/home/postgresql

    切换到postgres用户,使用initdb初始化数据库,这样在/home/postgresql下会增加很多东西。

    修改/usr/lib/systemd/system/postgresql-10.service文件的内容,在#Location of database direcotry里面指定正确的PGDATA:

    vi /usr/lib/systemd/system/postgresql-10.service
    #修改Environment=PGDATA=/var/lib/pgsql/10/data/为
    Environment=PGDATA=/home/postgresql
    

     

  4. 执行初始化数据库

    su - postgres
    initdb

     

  5. #配置数据库服务开机启动并立即启动数据库服务

    systemctl enable postgresql-10.service
    service postgresql-10 start
    service postgresql-10 status

     

  6. 创建kong数据库
    su - postgres
    qsql
    CREATE USER kong; CREATE DATABASE kong OWNER kong;

     

  7. 安装openresty依赖(切换到root)
  8. yum install -y epel-release
    yum install -y luarocks
  9.  yum install git -y
    git clone git://github.com/luarocks/luarocks.git
    ./configure --lua-suffix=jit --with-lua=/usr/local/openresty/luajit --with-lua-include=/usr/local/openresty/luajit/include/luajit-2.1
    make install
    1安装PCRE库(可在官网下载最新版本)
     
    mkdir /usr/local/nginxTools
    cd /usr/local/nginxTools
    yum install wget -y
    wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz 
    tar -zxvf pcre-8.39.tar.gz
    cd pcre-8.39
    ./configure
    make && make install

      2.安装openssl库
     
    yum -y install openssl openssl-devel

     

  10. 下载OpenResty压缩文件

  11. cd /usr/local/nginxTools
    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 --prefix=/usr/local/bin/openresty
    make -j2
    make install     //默认安装在--prefix指定的目录,这里是:/usr/local/bin/openresty
    #设置环境变量
    export PATH=/usr/local/openresty/bin:$PATH
  12. 安装kong
    cd /usr/local/nginxTools
    wget https://bintray.com/kong/kong-rpm/download_file?file_path=centos%2F7%2Fkong-1.0.3.el7.noarch.rpm -O kong-1.0.3.el7.noarch.rpm
    yum install kong-1.0.3.el7.noarch.rpm -y

     

  13. #准备kong的配置文件,
    cd /etc/kong
    cp kong.conf.default kong.conf
    # 在kong.conf中填入数据地址、用户、密码、端口、日志路径等
    
    #kong默认的代理地址改成:
    
    proxy_listen = 0.0.0.0:80, 0.0.0.0:443
    默认的管理地址是:
    
    admin_listen = 127.0.0.1:8001, 127.0.0.1:8444 ssl
    #初始化数据
    kong migrations bootstrap
    #创建kong的数据库:
    kong migrations up -c /etc/kong/kong.conf
    #启动kong:
    kong start -c /etc/kong/kong.conf
    #如果提示 [warn] ulimit is currently set to "1024". For better performance set it to at least "4096" 则修改一下ulimit 
    ulimit -n 4096
    

14上安装 Node.js 

mkdir /usr/software
cd /usr/software/
wget https://nodejs.org/dist/v10.9.0/node-v10.9.0-linux-x64.tar.xz    // 下载
tar xf  node-v10.9.0-linux-x64.tar.xz       // 解压
mv node-v10.9.0-linux-x64 nodejs              // 进入解压目录
ln -s /usr/software/nodejs/bin/npm   /usr/local/bin/ 
ln -s /usr/software/nodejs/bin/node   /usr/local/bin/
#node -v // 执行node命令 查看版本 v10.9.0
# Install Kong Dashboard
npm install -g kong-dashboard
ln -s /usr/software/nodejs/bin/kong-dashboard /usr/local/bin/
# Start Kong Dashboard
kong-dashboard start --kong-url http://0.0.0.0:8001
 
# Start Kong Dashboard on a custom port
#kong-dashboard start --kong-url http://kong:8001 --port [port]
 
# Start Kong Dashboard with basic auth
#kong-dashboard start --kong-url http://kong:8001 --basic-auth user1=password1 user2=password2
 
# See full list of start options
kong-dashboard start --help

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

懒人烂命

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值