Skip to content

Commit

Permalink
docs: rewrite "Installation via Source" (apache#6588)
Browse files Browse the repository at this point in the history
spacewander authored Mar 13, 2022
1 parent cd3e7cd commit cb71030
Showing 3 changed files with 51 additions and 38 deletions.
33 changes: 24 additions & 9 deletions docs/en/latest/how-to-build.md
Original file line number Diff line number Diff line change
@@ -86,30 +86,39 @@ Please refer to [Installing Apache APISIX with Helm Chart](https://github.com/ap

### Installation via Source Release Package

Note: if you want to package Apache APISIX for a specific platform, please refer to https://github.com/api7/apisix-build-tools and add the support there.
The instruction here is only for people who want to setup their Apache APISIX development environment.

Follow the steps below to install Apache APISIX via the source release package.

1. Create a directory named `apisix-2.12.0`.
1. Install dependencies

```shell
curl https://raw.githubusercontent.com/apache/apisix/master/utils/install-dependencies.sh -sL | bash -
```

2. Create a directory named `apisix-2.12.0`.

```shell
APISIX_VERSION='2.12.0'
mkdir apisix-${APISIX_VERSION}
```

2. Download the Apache APISIX source release package.
3. Download the Apache APISIX source release package.

```shell
wget https://downloads.apache.org/apisix/${APISIX_VERSION}/apache-apisix-${APISIX_VERSION}-src.tgz
```

You can also download the Apache APISIX source release package from the [Apache APISIX website](https://apisix.apache.org/downloads/). The website also provides source packages for Apache APISIX, APISIX Dashboard, and APISIX Ingress Controller.

3. Unzip the Apache APISIX source release package.
4. Uncompress the Apache APISIX source release package.

```shell
tar zxvf apache-apisix-${APISIX_VERSION}-src.tgz -C apisix-${APISIX_VERSION}
```

4. Install the runtime dependent Lua libraries.
5. Install the runtime dependent Lua libraries.

```shell
# Switch to the apisix-${APISIX_VERSION} directory
@@ -151,19 +160,17 @@ Follow the steps below to install Apache APISIX via the source release package.

**Note**: This operation will remove the files completely.

### LTS version installation via Source Release Package
#### LTS version installation via Source Release Package

The [current LTS version](https://apisix.apache.org/downloads/) of Apache APISIX is `2.10.4`.

To install this version, set `APISIX_VERSION`

Set `APISIX_VERSION` in [Installation via Source Release Package](#installation-via-source-release-package) to `2.10.4` and continue with the other steps.
To install this version, set `APISIX_VERSION` in [Installation via Source Release Package](#installation-via-source-release-package) to `2.10.4` and continue with the other steps.

## Step 2: Install etcd

This step is required only if you haven't installed [etcd](https://github.com/etcd-io/etcd).

Run the command below to install etcd via the binary.
Run the command below to install etcd via the binary in Linux:

```shell
ETCD_VERSION='3.4.13'
@@ -174,6 +181,14 @@ tar -xvf etcd-v${ETCD_VERSION}-linux-amd64.tar.gz && \
nohup etcd >/tmp/etcd.log 2>&1 &
```

Run the command below to install etcd in Mac:

```shell
brew install etcd
# start etcd server
brew services start etcd
```

## Step 3: Manage Apache APISIX Server

In the Apache APISIX directory, you can initialize dependencies, start service and stop service with commands. Run `apisix help` to get a full list of available commands.
35 changes: 26 additions & 9 deletions docs/zh/latest/how-to-build.md
Original file line number Diff line number Diff line change
@@ -84,28 +84,37 @@ sudo yum install ./apisix/*.rpm

### 通过源码包安装

1. 创建一个名为 `apisix-2.12.0` 的目录。
注意:如果你想针对特定平台打包 Apache APISIX,请更新 https://github.com/api7/apisix-build-tools。
以下步骤仅用于设置 Apache APISIX 的开发环境。

1. 安装依赖

```shell
curl https://raw.githubusercontent.com/apache/apisix/master/utils/install-dependencies.sh -sL | bash -
```

2. 创建一个名为 `apisix-2.12.0` 的目录。

```shell
APISIX_VERSION='2.12.0'
mkdir apisix-${APISIX_VERSION}
```

2. 下载 Apache APISIX Release 源码包:
3. 下载 Apache APISIX Release 源码包:

```shell
wget https://downloads.apache.org/apisix/${APISIX_VERSION}/apache-apisix-${APISIX_VERSION}-src.tgz
```

您也可以通过 Apache APISIX 官网下载 Apache APISIX Release 源码包。 Apache APISIX 官网也提供了 Apache APISIX、APISIX Dashboard 和 APISIX Ingress Controller 的源码包,详情请参考 [Apache APISIX 官网-下载页](https://apisix.apache.org/zh/downloads)

3. 解压 Apache APISIX Release 源码包:
4. 解压 Apache APISIX Release 源码包:

```shell
tar zxvf apache-apisix-${APISIX_VERSION}-src.tgz -C apisix-${APISIX_VERSION}
```

4. 安装运行时依赖的 Lua 库:
5. 安装运行时依赖的 Lua 库:

```shell
# 切换到 apisix-${APISIX_VERSION} 目录
@@ -147,15 +156,15 @@ sudo yum install ./apisix/*.rpm

请注意,该操作将完整**删除**相关文件。

### 通过源码包安装 LTS 版本
#### 通过源码包安装 LTS 版本

目前 Apache APISIX 的 LTS 版本为 `2.10.3`,将“[通过源码包安装](#通过源码包安装)”中的 `APISIX_VERSION` 设置成 `2.10.3` ,其他步骤按顺序进行即可。
目前 Apache APISIX 的 LTS 版本为 `2.10.4`,将“[通过源码包安装](#通过源码包安装)”中的 `APISIX_VERSION` 设置成 `2.10.4` ,其他步骤按顺序进行即可。

## 步骤2:安装 ETCD
## 步骤2:安装 etcd

如果你只通过 RPM、Docker 或源代码安装了 Apache APISIX,而没有安装 ETCD,则需要这一步。
如果你只通过 RPM、Docker 或源代码安装了 Apache APISIX,而没有安装 etcd,则需要这一步。

你可以通过 Docker 或者二进制等方式安装 ETCD。以下命令通过二进制方式安装 ETCD
你可以通过 Docker 或者二进制等方式安装 etcd。以下命令通过二进制方式在 Linux 上安装 etcd

```shell
ETCD_VERSION='3.4.13'
@@ -166,6 +175,14 @@ tar -xvf etcd-v${ETCD_VERSION}-linux-amd64.tar.gz && \
nohup etcd >/tmp/etcd.log 2>&1 &
```

以下命令在 Mac 上安装 etcd:

```shell
brew install etcd
# start etcd server
brew services start etcd
```

## 步骤3:管理 Apache APISIX 服务

我们可以在 Apache APISIX 的目录下使用命令初始化依赖、启动服务和停止服务,也可以通过 `apisix help` 命令查看所有命令和对应的功能。
21 changes: 1 addition & 20 deletions utils/install-dependencies.sh
Original file line number Diff line number Diff line change
@@ -85,10 +85,7 @@ function install_dependencies_with_apt() {
# Install dependencies on mac osx
function install_dependencies_on_mac_osx() {
# install OpenResty, etcd and some compilation tools
brew install openresty/brew/openresty luarocks lua@5.1 etcd curl git pcre openldap

# start etcd server
brew services start etcd
brew install openresty/brew/openresty luarocks lua@5.1 wget curl git pcre openldap
}

# Identify the different distributions and call the corresponding function
@@ -108,16 +105,6 @@ function multi_distro_installation() {
fi
}

# Install etcd
function install_etcd() {
ETCD_VERSION='3.4.13'
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 &
}

# Install LuaRocks
function install_luarocks() {
curl https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh -sL | bash -
@@ -141,15 +128,9 @@ function main() {

case_opt=$1
case "${case_opt}" in
"install_etcd")
install_etcd
;;
"install_luarocks")
install_luarocks
;;
"multi_distro_installation")
multi_distro_installation
;;
*)
echo "Unsupported method: ${case_opt}"
;;

0 comments on commit cb71030

Please sign in to comment.