Linux下apisix离线安装教程
- 一、首先需要安装etcd:
- 二、通过rpm离线安装apisix
- 三、启动apisix
- 四、安装apisix-dashboard
- 1、安装
- 2、更改dashboard登录账号名和密码
- 3、运行
一、首先需要安装etcd:
解压缩etcd后执行以下命令:
tar -xvf etcd-v3.5.4-linux-amd64.tar.gz && \
cd etcd-v3.5.4-linux-amd64 && \
sudo cp -a etcd etcdctl /usr/bin/
nohup etcd >/tmp/etcd.log 2>&1 &
二、通过rpm离线安装apisix
通过 RPM 包离线安装:
将 APISIX 离线 RPM 包下载到 apisix 文件夹:
sudo mkdir -p apisix
sudo yum install -y https://repos.apiseven.com/packages/centos/apache-apisix-repo-1.0-1.noarch.rpm
sudo yum clean all && yum makecache
sudo yum install -y --downloadonly --downloaddir=./apisix apisix
将apisix文件夹复制到目标主机到root文件夹下并运行以下命令:
Apisix文件夹下的内容。
执行以下命令:
sudo yum install ./apisix/*.rpm
如果提示缺少包依赖,则执行:
rpm -Uvh ./apisix/*.rpm --nodeps --force
三、启动apisix
APISIX 安装完成后,你可以运行以下命令初始化 NGINX 配置文件和 etcd:
apisix init
使用以下命令启动 APISIX:
apisix start
四、安装apisix-dashboard
1、安装
sudo yum install -y apisix-dashboard-3.0.1-0.el7.x86_64.rpm
2、更改dashboard登录账号名和密码
在/usr/local/apisix/dashboard/conf/conf.yaml下
#1、修改监听地址
conf:listen:host: 0.0.0.0 # the address on which the `Manager API` should listen.# The default value is 0.0.0.0, if want to specify, please enable it.# This value accepts IPv4, IPv6, and hostname.port: 9000 # The port on which the `Manager API` should listen.#2、设置允许访问的地址段allow_list: # If we don't set any IP list, then any IP access is allowed by default.- 0.0.0.0 # The rules are checked in sequence until the first match is found.- ::1#3、修改etcd连接信息etcd:endpoints: - 10.2.20.77:2379 #Apisix与Apisix-dashboard要使用同一个etcd#4、修改dashboard登录账户及密码
authentication:secret:secret # secret for jwt token generation.# NOTE: Highly recommended to modify this value to protect `manager api`.# if it's default value, when `manager api` start, it will generate a random string to replace it.expire_time: 3600 # jwt token expire time, in secondusers: # yamllint enable rule:comments-indentation- username: adminaaa # username and password for login `manager api`password: 123456
# - username: user
# password: user
3、运行
以下两种方式选一种,建议第二种
#run dashboard in the shell:
sudo manager-api -p /usr/local/apisix/dashboard/
#or run dashboard as a service:
systemctl start apisix-dashboard