Installation
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:
- Docker
- Helm
- RPM
- Source Code
First clone the apisix-docker repository:
Now, you can use to start APISIX.
- x86
- ARM/M1
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 install apisix apisix/apisix --create-namespace --namespace apisix
You can find other Helm charts on the 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:
Installation via DEB repository
Currently the only DEB repository supported by APISIX is Debian 11 (Bullseye) and supports both amd64 and arm64 architectures.
# amd64
sudo echo "deb http://openresty.org/package/debian bullseye openresty" | tee /etc/apt/sources.list.d/openresty.list
wget -O - http://repos.apiseven.com/pubkey.gpg | apt-key add -
echo "deb http://repos.apiseven.com/packages/debian bullseye main" | tee /etc/apt/sources.list.d/apisix.list
# arm64
sudo echo "deb http://openresty.org/package/debian bullseye openresty" | tee /etc/apt/sources.list.d/openresty.list
wget -O - http://repos.apiseven.com/pubkey.gpg | apt-key add -
echo "deb http://repos.apiseven.com/packages/arm64/debian bullseye main" | tee /etc/apt/sources.list.d/apisix.list
sudo apt update
sudo apt install -y apisix=3.0.0-0
First, download APISIX RPM offline package to an 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
Managing APISIX server
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.
If you want to build APISIX from source, please refer to .
APISIX uses 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:
- Linux
- macOS
brew services start etcd
You can configure your APISIX deployment in two ways:
By directly changing your configuration file (
conf/config.yaml
).By using the
--config
or the-c
flag to pass the path to your configuration file while starting APISIX.apisix start -c <path to config file>
APISIX will use the configurations added in this configuration file and will fall back to the default configuration if anything is not configured.
conf/config.yaml
apisix:
node_listen: 8000
Now, if you decide you want to change the etcd address to http://foo:2379
, you can add it to your configuration file. This will not change other configurations.
conf/config.yaml
node_listen: 8000
deployment:
role: traditional
role_traditional:
config_provider: etcd
etcd:
host:
- "http://foo:2379"
warning
APISIX’s default configuration can be found in conf/config-default.yaml
file and it should not be modified. It is bound to the source code and the configuration should only be changed by the methods mentioned above.
warning
The conf/nginx.conf
file is automatically generated and should not be modified.
APISIX deployment modes
APISIX has three different deployment modes for different use cases. To learn more and configure deployment modes, see the .
It is recommended to modify the Admin API key to ensure security.
You can update your configuration file as shown below:
conf/config.yaml
deployment:
admin:
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:9180/apisix/admin/routes?api_key=newsupersecurekey -i
Adding APISIX systemd unit file
If you installed APISIX via RPM, the APISIX unit file will already be configured and you can start APISIX by:
If you installed APISIX through other methods, you can create and add the configuration from the template.