本章节分别介绍ClickHouse 20.12.3.3-stable和ClickHouse 20.3.19.4-lts两个版本ClickHouse的编译和安装,请视具体情况选择一种。
1 2 |
cd /home git clone git://github.com/ClickHouse/ClickHouse.git |
如果执行git clone命令失败,github.com替换为github.com.cnpmjs.org。
1 2 |
cd ClickHouse git checkout v20.12.3.3-stable |
1
|
git submodule update --init --recursive |
1
|
sed -i 's/https/git/g' .gitmodules |
1
|
git submodule sync |
1
|
git submodule update --init --recursive |
若下载报错或者本章节后面步骤操作过程中报错缺少文件,参考FAQ中的问题1来解决,不需要重新执行git submodule update --init --recursive。
1 2 3 |
cd /home/ClickHouse/contrib/msgpack-c git checkout 4668426 git branch |
1 2 3 |
cd /home/ClickHouse/contrib/grpc git checkout a6570b8 git branch |
1 2 3 4 5 6 |
cd third_party/abseil-cpp git clone git://github.com/abseil/abseil-cpp.git git checkout a6570b8 git branch mv abseil-cpp/* ./ && rm -rf abseil-cpp ls |
1 2 3 4 5 6 |
cd ../cares/cares git clone git://github.com/c-ares/c-ares.git git checkout a6570b8 git branch mv c-ares/* ./ && rm -rf c-ares ls |
cd /home/ClickHouse/contrib/arrow git checkout 3cbcb7b git branch
编辑/home/ClickHouse/base/glibc-compatibility/CMakeLists.txt文件。
vi /home/ClickHouse/base/glibc-compatibility/CMakeLists.txt
将第30至32行修改为如下内容。
1 2 3 4 5 |
if (NOT ARCH_ARM) add_library (clickhouse_memcpy OBJECT ${ClickHouse_SOURCE_DIR}/contrib/FastMemcpy/memcpy_wrapper.c ) endif() |
1 2 3 |
cd /home/ClickHouse/contrib/boost git checkout a04e72c046 git branch |
1 2 3 |
cd /home/ClickHouse/contrib/brotli git checkout 5805f99 git branch |
1
|
vi /home/ClickHouse/contrib/libunwind/src/DwarfInstructions.hpp
|
1 2 |
auto page_size = sysconf(_SC_PAGESIZE); return ptr && (0 == syscall(SYS_mincore, (void*)(ptr / page_size * page_size), 1, &mincore_res) || errno == ENOSYS); |
1 2 |
export CC=clang export CXX=clang++ |
1 2 3 4 |
cd /home/ClickHouse rm -rf build mkdir -p build && cd build cmake .. -DENABLE_JEMALLOC=OFF -DCMAKE_INSTALL_PREFIX=/opt/clickhouse |
1
|
make -j `nproc` |
1
|
make install
|
1
|
ll /opt/clickhouse
|
1
|
/opt/clickhouse/bin/clickhouse-server --version
|
1 2 |
cd /home git clone git://github.com/ClickHouse/ClickHouse.git |
1 2 |
cd ClickHouse git checkout v20.3.19.4-lts |
1
|
git submodule update --init --recursive |
1 2 3 4 5 6 |
# 更改下载地址 sed -i 's/https/git/g' .gitmodules # 将新的URL更新到.git/config git submodule sync # 循环下载依赖 git submodule update --init --recursive |
1 2 |
cd /home/ClickHouse/contrib/simdjson git checkout avx512port |
1 2 3 4 |
cd /home/ClickHouse/contrib/grpc/third_party/cares/cares git clone git://github.com/c-ares/c-ares.git mv c-ares/* ./ && rm -rf c-ares/ ls |
1 2 |
cd /home/ClickHouse/contrib/arrow git checkout maint-0.15.x |
1 2 |
cd /home/ClickHouse/contrib/brotli git checkout v1.0 |
1 2 |
export CC=clang export CXX=clang++ |
1 2 3 4 |
cd /home/ClickHouse rm -rf build mkdir -p build && cd build cmake .. -DENABLE_JEMALLOC=OFF -DCMAKE_INSTALL_PREFIX=/opt/clickhouse |
1
|
make -j `nproc` |
1
|
make install
|
1
|
ll /opt/clickhouse
|
1
|
/opt/clickhouse/bin/clickhouse-server --version
|