title | keywords | description | ||
---|---|---|---|---|
Installation |
|
This document walks you through the different Apache APISIX installation methods. |
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
This guide walks you through how you can install and run Apache APISIX in your environment.
Refer to the Getting Started guide for a quick walk-through on running Apache APISIX.
APISIX can be installed by the different methods listed below:
<Tabs groupId="install-method" defaultValue="docker" values={[ {label: 'Docker', value: 'docker'}, {label: 'Helm', value: 'helm'}, {label: 'RPM', value: 'rpm'}, ]}>
First clone the apisix-docker repository:
git clone https://github.com/apache/apisix-docker.git
cd apisix-docker/example
Now, you can use docker-compose
to start APISIX.
<Tabs groupId="cpu-arch" defaultValue="x86" values={[ {label: 'x86', value: 'x86'}, {label: 'ARM/M1', value: 'arm'}, ]}>
docker-compose -p docker-apisix up -d
docker-compose -p docker-apisix -f docker-compose-arm64.yml up -d
To install APISIX via Helm, run:
helm repo add apisix https://charts.apiseven.com
helm repo update
helm install apisix apisix/apisix --create-namespace --namespace apisix
You can find other Helm charts on the apisix-helm-chart repository.
This installation method is suitable for CentOS 7 and Centos 8. If you choose this method to install APISIX, you need to install etcd first. For the specific installation method, please refer to Installing etcd.
If OpenResty is not installed, you can run the command below to install both OpenResty and APISIX repositories:
sudo yum install -y https://repos.apiseven.com/packages/centos/apache-apisix-repo-1.0-1.noarch.rpm
If OpenResty is installed, the command below will install the APISIX repositories:
sudo yum-config-manager --add-repo https://repos.apiseven.com/packages/centos/apache-apisix.repo
Then, to install APISIX, run:
sudo yum install apisix
:::tip
You can also install a specific version of APISIX by specifying it:
sudo yum install apisix-2.13.1
:::
First, download APISIX RPM offline package to an apisix
folder:
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
Then copy the apisix
folder to the target host and run:
sudo yum install ./apisix/*.rpm
Once APISIX is installed, you can initialize the configuration file and etcd by running:
apisix init
To start APISIX server, run:
apisix start
:::tip
Run apisix help
to get a list of all available operations.
:::
APISIX uses etcd to save and synchronize configuration. Before installing APISIX, you need to install etcd on your machine.
It would be installed automatically if you choose the Docker or Helm install method while installing APISIX. If you choose a different method or you need to install it manually, follow the steps shown below:
<Tabs groupId="os" defaultValue="linux" values={[ {label: 'Linux', value: 'linux'}, {label: 'macOS', value: 'mac'}, ]}>
ETCD_VERSION='3.4.18'
wget https://github.com/etcd-io/etcd/releases/download/v${ETCD_VERSION}/etcd-v${ETCD_VERSION}-linux-amd64.tar.gz
tar -xvf etcd-v${ETCD_VERSION}-linux-amd64.tar.gz && \
cd etcd-v${ETCD_VERSION}-linux-amd64 && \
sudo cp -a etcd etcdctl /usr/bin/
nohup etcd >/tmp/etcd.log 2>&1 &
brew install etcd
brew services start etcd
It is recommended to modify the Admin API key to ensure security.
You can update your configuration file as shown below:
apisix:
admin_key
-
name: "admin"
key: newsupersecurekey
role: admin
Now, to access the Admin API, you can use the new key:
curl http://127.0.0.1:9080/apisix/admin/routes?api_key=newsupersecurekey -i
If you installed APISIX via RPM, the APISIX unit file will already be configured and you can start APISIX by:
systemctl start apisix
systemctl stop apisix
If you installed APISIX through other methods, you can create /usr/lib/systemd/system/apisix.service
and add the configuration from the template.
See the Getting Started guide for a quick walk-through of using APISIX.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。