安装依赖:

参考:https://github.com/apache/incubator-apisix/blob/master/doc/install-dependencies.md#centos-7

# install epel, `luarocks` need it.
wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo rpm -ivh epel-release-latest-7.noarch.rpm

# add OpenResty source
sudo yum install yum-utils
sudo yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo

# install OpenResty, etcd and some compilation tools
sudo yum install -y etcd openresty curl git gcc luarocks lua-devel

# start etcd server
sudo service etcd start

安装apisix

(参考:https://github.com/apache/incubator-apisix/blob/master/doc/how-to-build-cn.md

  1. 下载apisix安装包:
    wget http://www.apache.org/dist/incubator/apisix/1.1/apache-apisix-1.1-incubating-src.tar.gz
    tar zxvf apache-apisix-1.1-incubating-src.tar.gz
    
  2. 安装运行时依赖的 Lua 库:
    cd apache-apisix-1.1-incubating
    make deps
    
  3. 将安装文件拷贝到/usr/local/apisix目录下
    make install
    copy -r deps /usr/local/apisix/
    

安装dashboard

  1. 下载apisix的dashboard
    git clone https://github.com/apache/incubator-apisix-dashboard.git
    
  2. 安装yarn
    curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
    sudo yum install yarn
    
  3. 安装nodejs
    1. 下载nodejs:
      https://cdn.npm.taobao.org/dist/node/v12.16.1/node-v12.16.1-linux-x64.tar.xz
    2. 解压目录:
      tar -xvf node-v12.16.1-linux-x64.tar.xz
      
    3. 将目录加入到PATH环境变量中
      export PATH=JAVA_HOME/bin:/usr/local/node-v12.14.1-linux-x64/bin
    4. build dashboard
      git checkout v1.0
      yarn && yarn build:prod
      
    5. 拷贝dashboard到apisix的安装目录
      mkdir -p /usr/local/apisix/dashboard
      cp -r dist/* /usr/local/apisix/dashboard
      

启动apisix并验证

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐