一 APISIX RPM 包安装(CentOS 7):
安装前需要安装相关依赖:OpenResty ,etcd。若已安装,可忽略。
# 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
# install etcd
wget https://github.com/etcd-io/etcd/releases/download/v3.4.13/etcd-v3.4.13-linux-amd64.tar.gz
tar -xvf etcd-v3.4.13-linux-amd64.tar.gz && \
cd etcd-v3.4.13-linux-amd64 && \
sudo cp -a etcd etcdctl /usr/bin/
# add OpenResty source
sudo yum install yum-utils
sudo yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
# install OpenResty and some compilation tools
sudo yum install -y openresty curl git gcc luarocks lua-devel
# start etcd server
nohup etcd &
安装APISIX 2.0版本
sudo yum install -y https://github.com/apache/apisix/releases/download/2.0/apisix-2.0-0.el7.noarch.rpm
安装好后,检查APISIX是否安装成功:
apisix version
启动APISIX:
apisix start
默认会安装在/usr/local/apisix路径下,默认端口9080,可通过如下命令检查:
curl 127.0.0.1:9080
{"error_msg":"404 Route Not Found"}
二 APISIX dashboard(控制台)安装
(1)git获取源码:
git clone https://github.com/apache/incubator-apisix-dashboard.git
cd incubator-apisix-dashboard
切换分支版本,需要与apisix版本一致即可
git checkout -b v2.0 origin/v2.0
(2)构建控制流:manager-api
控制流用于为控制台提供接口,相当于在APISIX与控制台之间的桥梁。手动构建需要如下步骤:
1.需要事先装好 Go 1.13+
注意:如果你想使用Orchestration的插件功能,需要安装Lua 5.1+已上版本。
2.检查环境变量
enable Go MODULE
go env -w GO111MODULE=on
对于我们国内用户,可以设置Goproxy代理加速下载模块
go env -w GOPROXY=https://goproxy.cn,direct
3.构建
api/build.sh
(3)构建web
1.确保机器上的Node.js版本在10.0.0+已上
2.安装yarn
3.安装依赖
cd web
yarn install
4.构建
yarn build
(4) 运行
1.根据部署的环境,可以修改相关配置,在如下文件中: api/conf/conf.json
{
"conf": {
"syslog": {
"host": "127.0.0.1"
},
"listen": {
"host": "127.0.0.1",
"port": 8080
},
"dag-lib-path": "/home/demo_user/workspace/apisix-dashboard/dag-to-lua-1.1/",
"etcd": {
"endpoints": "127.0.0.1:2379"
}
},
"authentication": {
"session": {
"secret": "secret",
"expireTime": 3600
},
"user": [
{
"username": "admin",
"password": "admin"
},
{
"username": "user",
"password": "user"
}
]
}
}
2.运行控制流 manager-api
api/run.sh &
3.在浏览器里访问http://127.0.0.1:8080,默认是8080端口
注意:
1.conf.dag-lib-path必须使用绝对路径;
2.conf.listen.host默认设置的是127.0.0.1,所以只能本机访问,如果想开放给任意用户可以配置0.0.0.0
3.conf.etcd.endpoints用于配置etcd的实例地址,如果有多台实例,可以如下配置:
{
"etcd": {
"endpoints": "127.0.0.1:2379,127.0.0.1:3379"
}
}
4.如果修改配置信息,需要先杀掉进程,然后再次启动
ps aux | grep manager-api
kill $process_id
安装好后,即可直接访问,控制台示例。
本文详细介绍了如何在CentOS 7上安装APISIX 2.0及APISIX Dashboard。首先,安装依赖OpenResty和etcd,然后通过RPM包安装APISIX并验证其运行状态。接着,逐步指导安装Dashboard,包括获取源码、构建manager-api和web组件,以及配置和启动。最后,提到了访问和配置Dashboard的相关注意事项。
&spm=1001.2101.3001.5002&articleId=109491951&d=1&t=3&u=50df0fbbdc62421e85cfc757e120a67f)
8万+

被折叠的 条评论
为什么被折叠?



