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.
#
-->
2019-06-20 17:41:54 +08:00
# Install Dependencies
2019-11-14 09:08:46 +08:00
- [CentOS 6 ](#centos-6 )
- [CentOS 7 ](#centos-7 )
- [Ubuntu 16.04 & 18.04 ](#ubuntu-1604--1804 )
- [Debian 9 & 10 ](#debian-9--10 )
- [Mac OSX ](#mac-osx )
2019-11-14 12:37:51 +08:00
- [How to compile the OpenResty ](#how-to-compile-the-openresty )
2019-11-25 13:09:32 +08:00
- [Note ](#note )
2019-06-20 17:41:54 +08:00
2019-10-23 15:27:20 +08:00
CentOS 6
========
```shell
2019-11-14 12:37:51 +08:00
# add OpenResty source
2019-10-23 15:27:20 +08:00
sudo yum install yum-utils
sudo yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
2019-11-14 12:37:51 +08:00
# install OpenResty, etcd and some compilation tools
2019-10-23 15:27:20 +08:00
sudo yum install -y openresty curl git gcc luarocks lua-devel make
wget https://github.com/etcd-io/etcd/releases/download/v3.3.13/etcd-v3.3.13-linux-amd64.tar.gz
tar -xvf etcd-v3.3.13-linux-amd64.tar.gz & & \
cd etcd-v3.3.13-linux-amd64 & & \
sudo cp -a etcd etcdctl /usr/bin/
# start etcd server
nohup etcd &
```
2019-06-20 17:41:54 +08:00
CentOS 7
========
```shell
# install epel, `luarocks` need it.
wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo rpm -ivh epel-release-latest-7.noarch.rpm
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
2019-11-14 12:37:51 +08:00
# install OpenResty, etcd and some compilation tools
2019-10-23 15:27:20 +08:00
sudo yum install -y etcd openresty curl git gcc luarocks lua-devel
2019-06-20 17:41:54 +08:00
# start etcd server
sudo service etcd start
```
2019-09-24 17:46:24 +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
2019-11-14 12:37:51 +08:00
# install OpenResty, etcd and some compilation tools
2019-10-31 09:27:28 +08:00
sudo apt-get install -y git etcd openresty curl luarocks
2019-06-20 17:41:54 +08:00
# start etcd server
sudo service etcd start
```
2019-09-24 17:46:24 +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
wget https://github.com/etcd-io/etcd/releases/download/v3.3.13/etcd-v3.3.13-linux-amd64.tar.gz
tar -xvf etcd-v3.3.13-linux-amd64.tar.gz & & \
cd etcd-v3.3.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
2019-10-23 15:27:20 +08:00
sudo apt-get install -y git openresty curl luarocks make
2019-08-16 15:59:08 +08:00
2019-06-20 17:41:54 +08:00
# start etcd server
nohup etcd &
```
2019-07-07 08:42:39 +08:00
Mac OSX
=======
```shell
2019-11-14 12:37:51 +08:00
# install OpenResty, etcd and some compilation tools
2019-10-23 15:27:20 +08:00
brew install openresty/brew/openresty etcd luarocks curl git
2019-07-07 08:42:39 +08:00
2019-09-09 18:03:16 +08:00
# start etcd server with v2 protocol
etcd --enable-v2=true &
2019-07-07 08:42:39 +08:00
```
2019-11-14 09:08:46 +08:00
2019-11-14 12:37:51 +08:00
How to compile the OpenResty
============================
2019-11-14 09:08:46 +08:00
Compiling OpenResty from source is very complicated, it's not easy to make it clear. So we recommend that you refer to the official installation documentation.
http://openresty.org/en/linux-packages.html
2019-11-25 13:09:32 +08:00
Note
====
- Apache APISIX currently only supports the v2 protocol storage to etcd, but the latest version of etcd (starting with 3.4) has turned off the v2 protocol by default.
You need to add `--enable-v2=true` to the startup parameter to enable the v2 protocol. The development of the v3 protocol supporting etcd has begun and will soon be available.
- If you want use Tengine instead of OpenResty, please take a look at this installation step script [Install Tengine at Ubuntu ](../.travis/linux_tengine_runner.sh ).