Centos7源码编译安装Clickhouse

Centos7 编译安装Clickhouse

  1. 检查是否支持SSE4.2
  2. 安装依赖项
  3. 安装高版本 gcc
  4. 安装cmake 3
  5. 源码安装Clickhouse
  6. 启动服务

1.检查是否支持SSE4.2

1
grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported"

2.安装依赖项

1
2
3
4
5
6
7
8
9
yum install git cmake ninja-build
yum install libicu-devel
yum install clang
yum install libicu-devel
yum install readline-devel
yum install mysql-devel
yum install openssl-devel
yum install unixODBC_devel
yum -y install bzip2

3.安装高版本 gcc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
wget ftp://ftp.fu-berlin.de/unix/languages/gcc/releases/gcc-8.2.0/gcc-8.2.0.tar.xz

xz -d gcc-8.2.0.tar.xz
tar xvf gcc-8.2.0.tar.xz

cd gcc-8.2.0
./contrib/download_prerequisites
cd ..
mkdir build
cd build
../gcc-8.2.0/configure --enable-languages=c,c++ --disable-multilib

export THREADS=$(grep -c ^processor /proc/cpuinfo)
make -j $THREADS
make install
hash gcc g++

gcc --version

ln -s /usr/local/bin/gcc /usr/local/bin/gcc-7
ln -s /usr/local/bin/g++ /usr/local/bin/g++-7
ln -s /usr/local/bin/gcc /usr/local/bin/cc
ln -s /usr/local/bin/g++ /usr/local/bin/c++


//更换 链接库 ,https://www.jianshu.com/p/28a0c98027a8
rm -f /usr/lib64/libstdc++.so.6

ln -s /usr/local/lib64/libstdc++.so.6.0.25 /usr/lib64/libstdc++.so.6

4.安装cmake 3

1
2
3
4
5
6
7
8
9
# https://blog.csdn.net/Imagine_Dragon/article/details/78398600

./bootstrap
gmake
gmake install

yum remove cmake -y
ln -s /usr/local/bin/cmake /usr/bin/
cmake --version

5.源码安装Clickhouse

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#clone 源码
git clone 下来
#安装子模块
git submodule update --init --recursive

mkdir build
cd build
cmake ..
export THREADS=$(grep -c ^processor /proc/cpuinfo)
make -j $THREADS
make install


#将配置文件copy 到/etc/clickhouse-server
mkdir /etc/clickhouse-server
cd ../dbms/programs/server
cp config.xml /etc/clickhouse-server/
cp users.xml /etc/clickhouse-server/

6. 启动服务

启动clickhouse-server

1
clickhouse-server --config-file=/etc/clickhouse-server/config.xml

启动clickhouse-server as a service

1
sudo service clickhouse-server start

启动客户端

1
2
3
clickhouse-client
clickhouse-client --host=example.com
clickhouse-client -m

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×