2021-02-26 21:40:08 +08:00
---
title: Install Dependencies
---
2019-10-31 09:27:28 +08:00
<!--
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
-->
2020-07-07 10:35:02 +08:00
- [Note ](#note )
2019-11-14 09:08:46 +08:00
- [CentOS 7 ](#centos-7 )
2020-07-04 07:48:10 +08:00
- [Fedora 31 & 32 ](#fedora-31--32 )
2019-11-14 09:08:46 +08:00
- [Ubuntu 16.04 & 18.04 ](#ubuntu-1604--1804 )
- [Debian 9 & 10 ](#debian-9--10 )
- [Mac OSX ](#mac-osx )
2019-06-20 17:41:54 +08:00
2021-02-26 21:40:08 +08:00
## Note
2021-01-03 11:26:40 +08:00
2020-11-13 16:08:43 +08:00
- Since v2.0 Apache APISIX would not support the v2 protocol storage to etcd anymore, and the minimum etcd version supported is v3.4.0. What's more, etcd v3 uses gRPC as the messaging protocol, while Apache APISIX uses HTTP(S) to communicate with etcd cluster, so be sure the [etcd gRPC gateway ](https://etcd.io/docs/v3.4.0/dev-guide/api_grpc_gateway/ ) is enabled.
2019-10-23 15:27:20 +08:00
2020-12-13 00:04:48 +08:00
- Now by default Apache APISIX uses HTTP protocol to talk with etcd cluster, which is insecure. Please configure certificate and corresponding private key for your etcd cluster, and use "https" scheme explicitly in the etcd endpoints list in your Apache APISIX configuration, if you want to keep the data secure and integral. See the etcd section in `conf/config-default.yaml` for more details.
2020-11-03 13:53:39 +08:00
2021-03-29 23:34:01 +08:00
- If you want use Tengine instead of OpenResty, please take a look at this installation step script [Install Tengine at Ubuntu ](https://github.com/apache/apisix/blob/master/ci/linux_tengine_runner.sh ).
2019-10-23 15:27:20 +08:00
2021-02-02 10:47:59 +08:00
- If it is OpenResty 1.19, APISIX will use OpenResty's built-in LuaJIT to run `bin/apisix` ; otherwise it will use Lua 5.1. If you encounter `luajit: lj_asm_x86.h:2819: asm_loop_ fixup: Assertion '((intptr_t)target & 15) == 0' failed` , this is a problem with the low version of OpenResty's built-in LuaJIT under certain compilation conditions.
2021-03-02 17:12:21 +08:00
- On some platforms, installing LuaRocks via the package manager will cause Lua to be upgraded to Lua 5.3, so we recommend installing LuaRocks via source code. if you install OpenResty and its OpenSSL develop library (openresty-openssl111-devel for rpm and openresty-openssl111-dev for deb) via the official repository, then [we provide a script for automatic installation ](https://github.com/apache/apisix/blob/master/utils/linux-install-luarocks.sh ). If you compile OpenResty yourself, you can refer to the above script and change the path in it. If you don't specify the OpenSSL library path when you compile, you don't need to configure the OpenSSL variables in LuaRocks, because the system's OpenSSL is used by default. If the OpenSSL library is specified at compile time, then you need to ensure that LuaRocks' OpenSSL configuration is consistent with OpenResty's.
2021-02-20 20:28:21 +08:00
- WARNING: If you are using OpenResty which is older than `1.17.8` , please installing openresty-openss-devel instead of openresty-openssl111-devel.
2021-01-29 23:57:46 +08:00
2021-02-26 21:40:08 +08:00
## CentOS 7
2019-06-20 17:41:54 +08:00
```shell
2020-10-04 19:15:58 +08:00
# 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/
2019-11-14 12:37:51 +08:00
# add OpenResty source
2019-06-20 17:41:54 +08:00
sudo yum install yum-utils
sudo yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
2020-10-04 19:15:58 +08:00
# install OpenResty and some compilation tools
2021-02-20 20:28:21 +08:00
sudo yum install -y openresty curl git gcc openresty-openssl111-devel unzip
2021-02-01 10:51:34 +08:00
# install LuaRocks
2021-02-06 00:01:08 +08:00
curl https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh -sL | bash -
2021-02-01 10:51:34 +08:00
2019-06-20 17:41:54 +08:00
# start etcd server
2020-10-04 19:15:58 +08:00
nohup etcd &
2019-06-20 17:41:54 +08:00
```
2021-02-26 21:40:08 +08:00
## Fedora 31 & 32
2020-07-04 07:48:10 +08:00
```shell
# add OpenResty source
sudo yum install yum-utils
sudo yum-config-manager --add-repo https://openresty.org/package/fedora/openresty.repo
2020-10-04 19:15:58 +08:00
# 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/
# install OpenResty and some compilation tools
2021-02-20 20:28:21 +08:00
sudo yum install -y openresty curl git gcc openresty-openssl111-devel
2021-02-01 10:51:34 +08:00
# install LuaRocks
2021-02-06 00:01:08 +08:00
curl https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh -sL | bash -
2020-07-04 07:48:10 +08:00
# start etcd server
2020-10-04 19:15:58 +08:00
nohup etcd &
2020-07-04 07:48:10 +08:00
```
2021-02-26 21:40:08 +08:00
## Ubuntu 16.04 & 18.04
2019-06-20 17:41:54 +08:00
```shell
2019-11-14 12:37:51 +08:00
# add OpenResty source
2019-06-20 17:41:54 +08:00
wget -qO - https://openresty.org/package/pubkey.gpg | sudo apt-key add -
2019-11-18 16:14:32 +08:00
sudo apt-get update
2019-06-20 17:41:54 +08:00
sudo apt-get -y install software-properties-common
sudo add-apt-repository -y "deb http://openresty.org/package/ubuntu $(lsb_release -sc) main"
sudo apt-get update
2020-10-04 19:15:58 +08:00
# 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/
# install OpenResty and some compilation tools
2021-02-20 20:28:21 +08:00
sudo apt-get install -y git openresty curl openresty-openssl111-dev
2021-02-01 10:51:34 +08:00
# install LuaRocks
2021-02-06 00:01:08 +08:00
curl https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh -sL | bash -
2019-06-20 17:41:54 +08:00
# start etcd server
2020-10-04 19:15:58 +08:00
nohup etcd &
2019-06-20 17:41:54 +08:00
```
2021-02-26 21:40:08 +08:00
## Debian 9 & 10
2019-06-20 17:41:54 +08:00
```shell
2019-09-12 09:27:31 +08:00
# optional
sed -i 's|^deb http://deb.debian.org/debian|deb http://mirrors.huaweicloud.com/debian|g' /etc/apt/sources.list
sed -i 's|^deb http://security.debian.org/debian-security|deb http://mirrors.huaweicloud.com/debian-security|g' /etc/apt/sources.list
apt update
apt install wget gnupg -y
2019-10-23 15:27:20 +08:00
2019-11-14 12:37:51 +08:00
# add OpenResty source
2019-06-20 17:41:54 +08:00
wget -qO - https://openresty.org/package/pubkey.gpg | sudo apt-key add -
sudo apt-get -y install software-properties-common
sudo add-apt-repository -y "deb http://openresty.org/package/debian $(lsb_release -sc) openresty"
sudo apt-get update
# install etcd
2020-10-04 19:15:58 +08:00
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 & & \
2019-07-02 20:45:59 +08:00
sudo cp -a etcd etcdctl /usr/bin/
2019-06-20 17:41:54 +08:00
2019-11-14 12:37:51 +08:00
# install OpenResty and some compilation tools
2021-02-20 20:28:21 +08:00
sudo apt-get install -y git openresty curl make openresty-openssl111-dev
2021-02-01 10:51:34 +08:00
# install LuaRocks
2021-02-06 00:01:08 +08:00
curl https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh -sL | bash -
2019-08-16 15:59:08 +08:00
2019-06-20 17:41:54 +08:00
# start etcd server
nohup etcd &
```
2021-02-26 21:40:08 +08:00
## Mac OSX
2019-07-07 08:42:39 +08:00
```shell
2019-11-14 12:37:51 +08:00
# install OpenResty, etcd and some compilation tools
2021-03-08 17:13:39 +08:00
brew install openresty/brew/openresty luarocks lua@5.1 etcd curl git
2019-07-07 08:42:39 +08:00
2020-09-16 10:19:04 +08:00
# start etcd server
2021-03-08 17:13:39 +08:00
brew services start etcd
2020-11-03 13:53:39 +08:00
# enable TLS for etcd server
etcd --cert-file=/path/to/cert --key-file=/path/to/pkey --advertise-client-urls https://127.0.0.1:2379
2019-07-07 08:42:39 +08:00
```