APISIX安装记录

依赖:

  1. etcd : 版本必须为v3.4以上,不支持3.4以下的版本

  1. openresty

  1. luarocks

etcd安装

https://github.com/etcd-io/etcd/releases/

访问以上页面,根据自己的系统选择相应的安装包进行下载。解压安装包,进入安装目录,

执行 nohup ./etcd --name infra1 --listen-client-urls http://172.16.254.131:2379 --advertise-client-urls http://172.16.254.131:2379 &根据自己的服务器地址和端口启动etcd。

后台运行 'nohup ./etcd --name infra1 --listen-client-urls http://172.16.254.129:2379 --advertise-client-urls http://172.16.254.129:2379 &'根据自己的服务器地址和端口启动etcd。

报错解决

在arm架构的服务器中会出现etcd on unsupported platform without ETCD_UNSUPPORTED_ARCH=arm64 set报错。输入export ETCD_UNSUPPORTED_ARCH=arm64 命令之后再次执行启动命令方可解决

openresty 安装

openresty依赖openssl,需要提前安装openssl

openssl 安装

下载源码包

openssl-1.1.1k.tar.gz

tar -zxvf openssl-version.tar.gz
cd openssl-version/
./config --prefix=/usr/local/openssl
make
make install

报错

报错1
     wget https://www.cpan.org/src/5.0/perl-5.30.1.tar.gz
     tar -xzf perl-5.30.1.tar.gz
     cd perl-5.30.1
     ./Configure -des -Dprefix=$HOME/localperl
     make
     make install
报错2

安装时一直报Go find a public domain implementation or fix your PATH setting!是因为安装系统的时候使用的是最小化mini安装,系统没有安装make。直接yum安装下即可:yum -y install gcc automake autoconf libtool make


openresty 安装

https://openresty.org/cn/download.html

下载源码包

openresty-1.19.3.2.tar.gz

tar -zxvf openresty-version.tar.gz
cd openresty-version

## --with 是启用一些插件 
## --without 是禁用一些插件
./configure --with-luajit \
            --without-http_redis2_module \
            --with-http_iconv_module \
            --with-http_stub_status_module \
            --with-http_realip_module \
            --with-http_v2_module \
            --with-openssl=/usr/local/openssl  
make
make install 

报错

报错1

报错 ‘/bin/sh: line 2: ./config: No such file or directory’

解决该问题,修改配置文件/bundle/nginx-1.11.2/auto/lib/openssl/conf中

/.openssl删除掉,也就是避免了找路径的时候找.openssl这个路径

解决问题后重新执行上一步的./configure
报错2

需要安装pcre的devel包,pcre-devel。使用yum安装即可:(以下命令还带有ssl、zlib等依赖的安装)

yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel
报错3

是CentOS 8没有安装epel源的问题。安装epel源后问题解决。

yum install epel-release
报错3

需要指定源码路径。因为openresty(确切的说,是nginx)依赖pcre做正则引擎,还有要用openssl做安全引擎。所以,先要安装pcre和openssl。千万注意,要用源码,在安装openresty的时候,通过--with-<module>指定源码路径。

./configure --prefix=/usr/local/openresty --with-pcre=/opt/pcre2-10.23 --with-openssl=/opt/openssl-1.1.0e

仍然报错,就直接去nginx下执行 ./configure。手动把nginx给解析了

配置openresty环境变量

vim /etc/profile

#文件末尾添加
export PATH=$PATH:/user/local/openresty/bin:/usr/local/openresty/nginx/sbin

source /etc/profile

luarocks 安装

Source code(tar.gz)

下载源码包

tar -zxvf luarocks-3.4.0.tar.gz

cd luarocks

./configure --with-lua=/usr/local/openresty/luajit

make build

make install

apisix安装

wget https://downloads.apache.org/apisix/2.12.0/apache-apisix-2.12.0-src.tgz
tar zxvf apache-apisix-2.12.0-src.tgz -C apisix-2.12.0
LUAROCKS_SERVER=https://luarocks.cn make deps
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
以下是使用Docker安装Apisix的步骤: 1. 首先,确保已经安装了Docker。如果没有安装,请参考[Docker官方文档](https://docs.docker.com/engine/install/)进行安装。 2. 打开终端或命令行界面,运行以下命令拉取Apisix镜像: ```shell docker pull apache/apisix ``` 3. 创建一个名为`apisix`的网络,用于Apisix容器和其他容器之间的通信: ```shell docker network create apisix ``` 4. 创建一个名为`apisix`的目录,用于存储Apisix的配置文件和日志: ```shell mkdir -p /usr/local/apisix ``` 5. 在`apisix`目录下创建一个名为`config.yaml`的配置文件,并将以下内容复制到文件中: ```yaml etcd: host: - "http://etcd:2379" ``` 6. 在`apisix`目录下创建一个名为`docker-compose.yaml`的文件,并将以下内容复制到文件中: ```yaml version: '3' services: etcd: image: quay.io/coreos/etcd:v3.4.13 command: etcd --listen-client-urls http://0.0.0.0:2379 --advertise-client-urls http://0.0.0.0:2379 networks: - apisix apisix: image: apache/apisix volumes: - /usr/local/apisix:/usr/local/apisix environment: - ETCD_HOSTS=http://etcd:2379 ports: - "9080:9080" - "9443:9443" networks: - apisix networks: apisix: external: true ``` 7. 在终端或命令行界面中,进入`apisix`目录,并运行以下命令启动Apisix容器: ```shell docker-compose up -d ``` 8. 等待一段时间,Apisix容器将会启动并运行。可以通过访问`http://localhost:9080`或`https://localhost:9443`来验证Apisix是否成功安装

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值