CentOS 7源码离线安装apisix3.4

1.安装etcd

wget https://github.com/etcd-io/etcd/releases/download/v3.4.18/etcd-v3.4.18-linux-amd64.tar.gz

tar -xvf etcd-v3.4.18-linux-amd64.tar.gz

cd etcd-v3.4.18-linux-amd64

sudo cp -a etcd etcdctl /usr/bin/

#启动etcd

nohup etcd >/tmp/etcd.log 2>&1 &

2.安装依赖

sudo yum install -y yum-utils

wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

sudo rpm -ivh epel-release-latest-7.noarch.rpm

#添加apisix源

rpm -q --quiet apache-apisix-repo-1.0-1.noarch || sudo yum install -y https://repos.apiseven.com/packages/centos/apache-apisix-repo-1.0-1.noarch.rpm

#安装apisix-base及一些编译工具

sudo yum install -y apisix-base curl wget git gcc openresty openresty-openssl111-devel unzip pcre pcre-devel openldap-devel luarocks lua-devel

#下载apisix源码安装包

wget Apache Downloads

tar -xvf apache-apisix-3.4.1-src.tgz

cd apache-apisix-3.4.1

#该命令将安装 APISIX 运行时依赖的 Lua 库和 apisix 命令。

sudo make deps

sudo make install

说明:1. apisix-base的作用:APISIX 的一些特性需要在 OpenResty 中引入额外的 NGINX 模块。如果要使用这些功能,你需要构建一个自定义的 OpenResty 发行版(APISIX-Base)。请参考 apisix-build-tools 配置你的构建环境并进行构建。

2. 默认安装在/us/local/apisix目录下

3.启动apisix

运行以下命令初始化 NGINX 配置文件和 etcd。

apisix init

运行以下命令测试配置文件,APISIX 将根据 config.yaml 生成 nginx.conf,并检查 nginx.conf 的语法是否正确。

apisix test

最后,你可以使用以下命令运行 APISIX。

apisix start

如果需要停止 APISIX,你可以使用 apisix quit 或者 apisix stop 命令。

apisix quit 将正常关闭 APISIX,该指令确保在停止之前完成所有收到的请求。

apisix quit

apisix stop 命令会强制关闭 APISIX 并丢弃所有请求。

apisix stop

4.可能出现的问题:

出现 Error unknown directive "lua_package_path" in /API_ASPIX/apisix/t/servroot/conf/nginx.conf 报错,是因为默认的 NGINX 安装路径未找到,解决方法如下:

Linux 默认安装路径:

export PATH=/usr/local/openresty/nginx/sbin:$PATH

5.源码方式安装apisix dashboard

说明:dashboard项目包括manager-api和web,但是web是可选的

#需要准备的环境

对于manager-api需要具备下面的环境:

1.Golang 1.16+

对于中国大陆的用户,可以进行以下设置加速模块的下载

$ go env -w GOPROXY=https://goproxy.cn,direct

对于web需要具备下面的环境:

1. Node.js current LTS (14.x+)

2. Yarn

#下载源码

wget Apache Downloads

tar -xvf apache-apisix-dashboard-3.0.0-src.tgz

cd apache-apisix-dashboard-3.0.0

#构建,构建完成后,结果保存在output目录下

sudo make build

说明:make build将构建manager-api和web。

#拷贝dashboard到apisix的安装目录

mkdir -p /usr/local/apisix/dashboard

cp -r output/* /usr/local/apisix/dashboard

#启动,需要确保etcd已经运行

#根据运行环境检查并修改配置文件:/usr/local/apisix/dashboard/conf/conf.yaml

#启动dashboard

cd /usr/local/apisix/dashboard

nohup ./manager-api &

如果没改配置的话,访问http://127.0.0.1:9000 就可以看到dashboard GUI,默认用户名和密码都是admin。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值