2022-08-26 19:07:59 +00:00
|
|
|
---
|
|
|
|
slug: /zh/development/build
|
|
|
|
---
|
2020-03-20 18:20:59 +00:00
|
|
|
# 如何构建 ClickHouse 发布包 {#ru-he-gou-jian-clickhouse-fa-bu-bao}
|
2018-12-10 09:19:32 +00:00
|
|
|
|
2020-03-20 18:20:59 +00:00
|
|
|
## 安装 Git 和 Pbuilder {#an-zhuang-git-he-pbuilder}
|
2018-12-10 09:19:32 +00:00
|
|
|
|
2020-03-20 18:20:59 +00:00
|
|
|
``` bash
|
2018-12-10 09:19:32 +00:00
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install git pbuilder debhelper lsb-release fakeroot sudo debian-archive-keyring debian-keyring
|
|
|
|
```
|
|
|
|
|
2020-03-20 18:20:59 +00:00
|
|
|
## 拉取 ClickHouse 源码 {#la-qu-clickhouse-yuan-ma}
|
2018-12-10 09:19:32 +00:00
|
|
|
|
2020-03-20 18:20:59 +00:00
|
|
|
``` bash
|
2020-03-11 07:25:43 +00:00
|
|
|
git clone --recursive https://github.com/ClickHouse/ClickHouse.git
|
2018-12-10 09:19:32 +00:00
|
|
|
cd ClickHouse
|
|
|
|
```
|
|
|
|
|
2020-03-20 18:20:59 +00:00
|
|
|
## 运行发布脚本 {#yun-xing-fa-bu-jiao-ben}
|
2018-12-10 09:19:32 +00:00
|
|
|
|
2020-03-20 18:20:59 +00:00
|
|
|
``` bash
|
2018-12-10 09:19:32 +00:00
|
|
|
./release
|
|
|
|
```
|
|
|
|
|
2020-03-20 18:20:59 +00:00
|
|
|
# 如何在开发过程中编译 ClickHouse {#ru-he-zai-kai-fa-guo-cheng-zhong-bian-yi-clickhouse}
|
2018-12-10 09:19:32 +00:00
|
|
|
|
|
|
|
以下教程是在 Ubuntu Linux 中进行编译的示例。
|
|
|
|
通过适当的更改,它应该可以适用于任何其他的 Linux 发行版。
|
2020-10-13 17:23:29 +00:00
|
|
|
仅支持具有 x86_64、AArch64。 对 Power9 的支持是实验性的。
|
2018-12-10 09:19:32 +00:00
|
|
|
|
2020-03-20 18:20:59 +00:00
|
|
|
## 安装 Git 和 CMake 和 Ninja {#an-zhuang-git-he-cmake-he-ninja}
|
2018-12-10 09:19:32 +00:00
|
|
|
|
2020-03-20 18:20:59 +00:00
|
|
|
``` bash
|
2018-12-10 09:19:32 +00:00
|
|
|
sudo apt-get install git cmake ninja-build
|
|
|
|
```
|
|
|
|
|
2020-04-08 14:22:25 +00:00
|
|
|
或cmake3而不是旧系统上的cmake。
|
2018-12-10 09:19:32 +00:00
|
|
|
或者在早期版本的系统中用 cmake3 替代 cmake
|
|
|
|
|
2021-04-22 01:20:03 +00:00
|
|
|
## 安装 Clang
|
2018-12-10 09:19:32 +00:00
|
|
|
|
2021-04-22 01:20:03 +00:00
|
|
|
On Ubuntu/Debian you can use the automatic installation script (check [official webpage](https://apt.llvm.org/))
|
2018-12-10 09:19:32 +00:00
|
|
|
|
2021-04-22 01:20:03 +00:00
|
|
|
```bash
|
|
|
|
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
|
2018-12-10 09:19:32 +00:00
|
|
|
```
|
|
|
|
|
2020-03-20 18:20:59 +00:00
|
|
|
## 拉取 ClickHouse 源码 {#la-qu-clickhouse-yuan-ma-1}
|
2018-12-10 09:19:32 +00:00
|
|
|
|
2020-03-20 18:20:59 +00:00
|
|
|
``` bash
|
2020-03-11 07:25:43 +00:00
|
|
|
git clone --recursive git@github.com:ClickHouse/ClickHouse.git
|
|
|
|
# or: git clone --recursive https://github.com/ClickHouse/ClickHouse.git
|
2018-12-10 09:19:32 +00:00
|
|
|
|
|
|
|
cd ClickHouse
|
|
|
|
```
|
|
|
|
|
2020-03-20 18:20:59 +00:00
|
|
|
## 编译 ClickHouse {#bian-yi-clickhouse}
|
2018-12-10 09:19:32 +00:00
|
|
|
|
2020-03-20 18:20:59 +00:00
|
|
|
``` bash
|
2018-12-10 09:19:32 +00:00
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
cmake ..
|
|
|
|
ninja
|
|
|
|
cd ..
|
|
|
|
```
|
|
|
|
|
|
|
|
若要创建一个执行文件, 执行 `ninja clickhouse`。
|
2020-04-08 14:22:25 +00:00
|
|
|
这个命令会使得 `programs/clickhouse` 文件可执行,您可以使用 `client` 或 `server` 参数运行。
|
2018-12-10 09:19:32 +00:00
|
|
|
|
2021-09-19 20:05:54 +00:00
|
|
|
[来源文章](https://clickhouse.com/docs/en/development/build/) <!--hide-->
|