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