上传离线包
#ll
apisix-3.2.2-0.el7.x86_64.rpm
apisix-base-1.21.4.1.8-0.el7.x86_64.rpm
apisix-dashboard-3.0.1-0.el7.x86_64.rpm
cyrus-sasl-2.1.26-24.el7_9.x86_64.rpm
cyrus-sasl-devel-2.1.26-24.el7_9.x86_64.rpm
cyrus-sasl-gssapi-2.1.26-24.el7_9.x86_64.rpm
cyrus-sasl-lib-2.1.26-24.el7_9.x86_64.rpm
cyrus-sasl-plain-2.1.26-24.el7_9.x86_64.rpm
openldap-2.4.44-25.el7_9.x86_64.rpm
openldap-devel-2.4.44-25.el7_9.x86_64.rpm
openresty-openssl111-1.1.1s-1.el7.x86_64.rpm
openresty-openssl111-devel-1.1.1s-1.el7.x86_64.rpm
openresty-pcre-8.45-1.el7.x86_64.rpm
openresty-zlib-1.2.13-1.el7.x86_64.rpm
执行安装
sudo rpm -ivh openresty-zlib-1.2.13-1.el7.x86_64.rpm
warning: openresty-zlib-1.2.13-1.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID d5edeb74: NOKEY
Preparing... ################################# [100%]
Updating / installing...1:openresty-zlib-1.2.13-1.el7 ################################# [100%]
[apisix@apisix-node1 apisix]$
[apisix@apisix-node1 apisix]$ sudo rpm -ivh openresty-pcre-8.45-1.el7.x86_64.rpm
warning: openresty-pcre-8.45-1.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID d5edeb74: NOKEY
Preparing... ################################# [100%]
Updating / installing...1:openresty-pcre-8.45-1.el7 ################################# [100%]
[apisix@apisix-node1 apisix]$
[apisix@apisix-node1 apisix]$ sudo rpm -ivh openresty-openssl111-1.1.1s-1.el7.x86_64.rpm
warning: openresty-openssl111-1.1.1s-1.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID d5edeb74: NOKEY
Preparing... ################################# [100%]
Updating / installing...1:openresty-openssl111-1.1.1s-1.el7################################# [100%]
[apisix@apisix-node1 apisix]$
[apisix@apisix-node1 apisix]$ sudo rpm -ivh cyrus-sasl-lib-2.1.26-24.el7_9.x86_64.rpm
Preparing... ################################# [100%]file /usr/lib64/libsasl2.so.3.0.0 from install of cyrus-sasl-lib-2.1.26-24.el7_9.x86_64 conflicts with file from package cyrus-sasl-lib-2.1.26-23.el7.x86_64file /usr/lib64/sasl2/libanonymous.so.3.0.0 from install of cyrus-sasl-lib-2.1.26-24.el7_9.x86_64 conflicts with file from package cyrus-sasl-lib-2.1.26-23.el7.x86_64file /usr/lib64/sasl2/libsasldb.so.3.0.0 from install of cyrus-sasl-lib-2.1.26-24.el7_9.x86_64 conflicts with file from package cyrus-sasl-lib-2.1.26-23.el7.x86_64file /usr/sbin/sasldblistusers2 from install of cyrus-sasl-lib-2.1.26-24.el7_9.x86_64 conflicts with file from package cyrus-sasl-lib-2.1.26-23.el7.x86_64file /usr/sbin/saslpasswd2 from install of cyrus-sasl-lib-2.1.26-24.el7_9.x86_64 conflicts with file from package cyrus-sasl-lib-2.1.26-23.el7.x86_64
发现有冲突,确保没有其他进程在用冲突包后,直接强制安装
# sudo rpm -ivh cyrus-sasl-lib-2.1.26-24.el7_9.x86_64.rpm --force --nodeps
Preparing... ################################# [100%]
Updating / installing...1:cyrus-sasl-lib-2.1.26-24.el7_9 ################################# [100%]
参数说明
1、–nodeps – force
加上那两个参数的意义就在于,安装时不再分析包之间的依赖关系而直接安装,也就不会再提示error: Failed dependencies:这样的错误了
2、–replacefiles
安装提示软件冲突时,添加–replacefiles参数即可。
继续安装
sudo rpm -ivh cyrus-sasl-plain-2.1.26-24.el7_9.x86_64.rpm
Preparing... ################################# [100%]
Updating / installing...1:cyrus-sasl-plain-2.1.26-24.el7_9 ################################# [100%]
[apisix@apisix-node1 apisix]$ sudo rpm -ivh cyrus-sasl-gssapi-2.1.26-24.el7_9.x86_64.rpm
Preparing... ################################# [100%]
Updating / installing...1:cyrus-sasl-gssapi-2.1.26-24.el7_9################################# [100%]
[apisix@apisix-node1 apisix]$ sudo rpm -ivh openldap-2.4.44-25.el7_9.x86_64.rpm
Preparing... ################################# [100%]file /usr/lib64/liblber-2.4.so.2.10.7 from install of openldap-2.4.44-25.el7_9.x86_64 conflicts with file from package openldap-2.4.44-20.el7.x86_64file /usr/lib64/libldap-2.4.so.2.10.7 from install of openldap-2.4.44-25.el7_9.x86_64 conflicts with file from package openldap-2.4.44-20.el7.x86_64file /usr/lib64/libldap_r-2.4.so.2.10.7 from install of openldap-2.4.44-25.el7_9.x86_64 conflicts with file from package openldap-2.4.44-20.el7.x86_64file /usr/lib64/libslapi-2.4.so.2.10.7 from install of openldap-2.4.44-25.el7_9.x86_64 conflicts with file from package openldap-2.4.44-20.el7.x86_64
[apisix@apisix-node1 apisix]$ sudo rpm -ivh openldap-2.4.44-25.el7_9.x86_64.rpm --force --nodeps
Preparing... ################################# [100%]
Updating / installing...1:openldap-2.4.44-25.el7_9 ################################# [100%]
[apisix@apisix-node1 apisix]$
[apisix@apisix-node1 apisix]$ sudo rpm -ivh cyrus-sasl-2.1.26-24.el7_9.x86_64.rpm
Preparing... ################################# [100%]
Updating / installing...1:cyrus-sasl-2.1.26-24.el7_9 ################################# [100%]
[apisix@apisix-node1 apisix]$ sudo rpm -ivh cyrus-sasl-devel-2.1.26-24.el7_9.x86_64.rpm
Preparing... ################################# [100%]
Updating / installing...1:cyrus-sasl-devel-2.1.26-24.el7_9 ################################# [100%]
[apisix@apisix-node1 apisix]$
[apisix@apisix-node1 apisix]$ sudo rpm -ivh openldap-devel-2.4.44-25.el7_9.x86_64.rpm
Preparing... ################################# [100%]
Updating / installing...1:openldap-devel-2.4.44-25.el7_9 ################################# [100%]
[apisix@apisix-node1 apisix]$ sudo rpm -ivh apisix-base-1.21.4.1.8-0.el7.x86_64.rpm
warning: apisix-base-1.21.4.1.8-0.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 96c07346: NOKEY
Preparing... ################################# [100%]
Updating / installing...1:apisix-base-1.21.4.1.8-0.el7 ################################# [100%]
[apisix@apisix-node1 apisix]$ sudo rpm -ivh apisix-3.2.2-0.el7.x86_64.rpm
warning: apisix-3.2.2-0.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 96c07346: NOKEY
Preparing... ################################# [100%]
Updating / installing...1:apisix-3.2.2-0.el7 ################################# [100%]
[apisix@apisix-node1 apisix]$
修改配置文件
# sudo vi /usr/local/apisix/conf/config.yaml
apisix:node_listen: 9080enable_ipv6: truessl:enable: falselisten:- port: 9182enable_admin: trueenable_control: falsecontrol:ip: 10.21.10.111port: 9284deployment:role: traditionalrole_traditional:config_provider: etcdetcd:host:- http://10.21.10.111:2379user: rootpassword: auyd871477shaprefix: "/apisix"use_grpc: falseadmin:allow_admin:- 0.0.0.0/0admin_key:- name: adminrole: adminadmin_listen:ip: 0.0.0.0port: 9180
参数说明
参数说明:
node_listen
:apisix 监听端口(前台页面访问使用的端口)
etcd.host
: etcd集群IP端口配置
etcd.user
:etcd集群账号
etcd.password
:etcd集群密码
admin.admin_key
:admin管理态的用户和认证用户
allow_admin
:白名单配置(IP层面控制访问apisix权限),如果不清楚子网掩码等情况下,可以配置成0.0.0.0/0
,其余删掉
admin_listen
:admin管理态监听端口
其他配置
1.隐藏网页请求时暴露的server版本信息,修改后需重启apisix。建议修改
vi /usr/local/apisix/conf/config-default.yaml
# 修改以下参数后面的值为false
enable_server_tokens: true --> enable_server_tokens: false
2.修改apisix启动的nginx的默认worker process数量。按需修改
默认情况apisix启动的nginx的worker process数据等于当前服务器的cpu核心数,如果需要调整请修改如下配置,修改后需重启apisix
vi /usr/local/apisix/conf/config-default.yaml
# 修改以下参数后面的值为需要的数
# auto为等于当前服务器的cpu核心数 --> 仅开启8个worker process
worker_processes: auto --> worker_processes: 8
启动apisix
初始化:apisix init
启动:apisix start
停止:apisix stop (命令无效的情况可以查看pid ps -ef | grep apisix 然后kill -9 pid 的方式停止。需要注意的是,要同时把nginx的进程也全部kill掉 )
# apisix init
/usr/local/openresty//luajit/bin/luajit /usr/local/apisix/apisix/cli/apisix.lua initWARNING: using fixed Admin API token has security risk.
Please modify "admin_key" in conf/config.yaml .[root@apisix-node1 dashboard]#
[root@apisix-node1 dashboard]# apisix start
/usr/local/openresty//luajit/bin/luajit /usr/local/apisix/apisix/cli/apisix.lua startWARNING: using fixed Admin API token has security risk.
Please modify "admin_key" in conf/config.yaml .[root@apisix-node1 dashboard]#
[root@apisix-node1 dashboard]# apisix status
/usr/local/openresty//luajit/bin/luajit /usr/local/apisix/apisix/cli/apisix.lua status
invalid argument: status
Usage: apisix [action] <argument>help: show this message, then exit
init: initialize the local nginx.conf
init_etcd: initialize the data of etcd
start: start the apisix server
stop: stop the apisix server
quit: stop the apisix server gracefully
restart: restart the apisix server
reload: reload the apisix server
test: test the generated nginx.conf
version: print the version of apisix
安装apisix-dashboard
# sudo rpm -ivh apisix-dashboard-3.0.1-0.el7.x86_64.rpm
Preparing... ################################# [100%]
Updating / installing...1:apisix-dashboard-local-3.0.1-0.el################################# [100%]
修改配置
/usr/local/apisix/dashboard/conf/conf.yaml
less conf/conf.yaml | grep -v "#"conf:listen:etcd:- 10.21.10.111:2379mtls:log:error_log:file_path:access_log:file_path:authentication:secret:password: adminplugins:- api-breaker- authz-casbin- authz-casdoor- authz-keycloak- aws-lambda- azure-functions- basic-auth- clickhouse-logger- client-control- consumer-restriction- cors- csrf- datadog- echo- error-log-logger- ext-plugin-post-req- ext-plugin-post-resp- ext-plugin-pre-req- fault-injection- file-logger- forward-auth- google-cloud-logging- grpc-transcode- grpc-web- gzip- hmac-auth- http-logger- ip-restriction- jwt-auth- kafka-logger- kafka-proxy- key-auth- ldap-auth- limit-conn- limit-count- limit-req- loggly- mocking- opa- openid-connect- opentelemetry- openwhisk- prometheus- proxy-cache- proxy-control- proxy-mirror- proxy-rewrite- public-api- real-ip- redirect- referer-restriction- request-id- request-validation- response-rewrite- rocketmq-logger- server-info- serverless-post-function- serverless-pre-function- skywalking- skywalking-logger- sls-logger- splunk-hec-logging- syslog- tcp-logger- traffic-split- ua-restriction- udp-logger- uri-blocker- wolf-rbac- zipkin- elasticsearch-logge- openfunction- tencent-cloud-cls- ai- cas-auth
参数说明
listen.host: dashboard部署服务器IP
listen.port: dashboard启动监听端口
etcd.endpoints:部署的ETCD集群 信息以及ETCD认证账号密码
authentication.users:dashboard管理页面登录账号密码
启动apisix-dashboard
# 启动apisix-dashboard
systemctl start apisix-dashboard
# 停止apisix-dashboard
systemctl stop apisix-dashboard
# 检查apisix-dashboard运行状态
systemctl status apisix-dashboard
# systemctl status apisix-dashboard
● apisix-dashboard.service - apisix-dashboardLoaded: loaded (/usr/lib/systemd/system/apisix-dashboard.service; static; vendor preset: disabled)Active: inactive (dead)Sep 14 11:18:18 apisix-node1 systemd[1]: Dependency Conflicts=apisix-dashboard.service dropped from unit apisix-dashboard.service
[root@apisix-node1 dashboard]#
[root@apisix-node1 dashboard]# systemctl start apisix-dashboard
[root@apisix-node1 dashboard]#
[root@apisix-node1 dashboard]# systemctl status apisix-dashboard
● apisix-dashboard.service - apisix-dashboardLoaded: loaded (/usr/lib/systemd/system/apisix-dashboard.service; static; vendor preset: disabled)Active: active (running) since Sat 2024-09-14 11:18:29 CST; 4s agoMain PID: 6662 (manager-api)CGroup: /system.slice/apisix-dashboard.service└─6662 /usr/local/apisix/dashboard/manager-api -c /usr/local/apisix/dashboard/conf/conf.yamlSep 14 11:18:29 apisix-node1 systemd[1]: Started apisix-dashboard.
Sep 14 11:18:30 apisix-node1 manager-api[6662]: The manager-api is running successfully!
Sep 14 11:18:30 apisix-node1 manager-api[6662]: Version : 3.0.1
Sep 14 11:18:30 apisix-node1 manager-api[6662]: GitHash : 397c0cb
Sep 14 11:18:30 apisix-node1 manager-api[6662]: Config File: /usr/local/apisix/dashboard/conf/conf.yaml
Sep 14 11:18:30 apisix-node1 manager-api[6662]: Listen : 10.21.10.111:9077
Sep 14 11:18:30 apisix-node1 manager-api[6662]: Loglevel: warn
Sep 14 11:18:30 apisix-node1 manager-api[6662]: ErrorLogFile: /usr/local/apisix/dashboard/logs/error.log
Sep 14 11:18:30 apisix-node1 manager-api[6662]: AccessLogFile: /usr/local/apisix/dashboard/logs/access.log