1、安装依赖
# 安装 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/
# 添加 OpenResty 源
sudo yum install yum-utils
sudo yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
# 安装 OpenResty 和 编译工具
sudo yum install -y openresty curl git gcc openresty-openssl111-devel unzip pcre pcre-devel
# 安装 LuaRocks
curl https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh -sL | bash -
# 开启 etcd server
nohup etcd &
【etcd检查】
# 查看etcd安装版本
etcd --version
curl -L http://127.0.0.1:2380/version
# 查看端口
netstat -anp | grep 2380
# 安装目录
/usr/bin/
2、安装apisix
# 通过RPM包安装,这种安装方式适用于CentOS7操作系统
sudo yum install -y https://github.com/apache/apisix/releases/download/2.10.0/apisix-2.10.0-0.el7.x86_64.rpm
【初始化和启动 】
# 初始化依赖
apisix init
# 启动
apisix start
【若启动报错!】
[root@bpm-web apisix]# apisix start
/usr/local/openresty/luajit/bin/luajit /usr/local/apisix/apisix/cli/apisix.lua start
Warning! Current maximum number of open file descriptors [1024] is too small, please increase user limits by execute 'ulimit -n <new user limits>' , otherwise the performance is low.
Warning! Request etcd endpoint 'http://127.0.0.1:2379/version' error, connection refused, retry time=1
Warning! Request etcd endpoint 'http://127.0.0.1:2379/version' error, connection refused, retry time=2
request etcd endpoint 'http://127.0.0.1:2379/version' error, connection refused
【原因:系统open files设置太少】
【解决】
vim /etc/security/limits.conf
【追加两行】
* soft nofile 65536
* hard nofile 65536
【再次启动】
[root@bpm-web tyke]# apisix start
/usr/local/openresty/luajit/bin/luajit /usr/local/apisix/apisix/cli/apisix.lua start
【apisix检查】
# 查看帮助命令
[root@bpm-web tyke]# apisix help
# 查看端口
netstat -anp | grep 9080
# 安装目录
/usr/local/apisix
3、安装dashboard
# yum安装rpm
sudo yum install -y https://github.com/apache/apisix-dashboard/releases/download/v2.9.0/apisix-dashboard-2.9.0-0.el7.x86_64.rpm
# 服务方式启动
sudo manager-api start -p /usr/local/apisix/dashboard/
# 查看帮助命令
[root@bpm-web conf]# manager-api help
【浏览器访问】
# 访问http://ip:9000/
#报IP address not allowed
{"Code":20002,"Message":"IP address not allowed","Data":null,"SourceSrv":""}
【设置允许其他IP访问 】
[root@bpm-web conf]# pwd
/usr/local/apisix/dashboard/conf
[root@bpm-web conf]# vim conf.yaml
【重新启动】
[root@i-E42D8BAE conf]# manager-api stop
[root@i-E42D8BAE conf]# manager-api start
Starting Apache APISIX Dashboard: [ OK ]
【检查】
# 查看dashboard状态
[root@i-E42D8BAE conf]# manager-api status
Service (pid 18338) is running...
# 安装目录
/usr/local/apisix/dashboard/
# 查看帮助命令
[root@i-E42D8BAE conf]# manager-api help
【访问验证】
浏览器访问http://ip:9000/
登录账号密码默认:admin/admin