Installation

    Official pre-built binaries are typically compiled for x86_64 and leverage SSE 4.2 instruction set, so unless otherwise stated usage of CPU that supports it becomes an additional system requirement. Here’s the command to check if current CPU has support for SSE 4.2:

    To run ClickHouse on processors that do not support SSE 4.2 or have AArch64 or PowerPC64LE architecture, you should build ClickHouse from sources with proper configuration adjustments.

    It is recommended to use official pre-compiled packages for Debian or Ubuntu. Run these commands to install packages:

    1. sudo apt-get install apt-transport-https ca-certificates dirmngr
    2. sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4
    3. echo "deb https://repo.clickhouse.tech/deb/stable/ main/" | sudo tee \
    4. /etc/apt/sources.list.d/clickhouse.list
    5. sudo apt-get update
    6. sudo apt-get install -y clickhouse-server clickhouse-client
    7. sudo service clickhouse-server start
    8. clickhouse-client

    If you want to use the most recent version, replace stable with testing (this is recommended for your testing environments).

    You can also download and install packages manually from .

    Packages

    • clickhouse-common-static — Installs ClickHouse compiled binary files.
    • clickhouse-server — Creates a symbolic link for clickhouse-server and installs the default server configuration.
    • clickhouse-client — Creates a symbolic link for clickhouse-client and other client-related tools. and installs client configuration files.
    • clickhouse-common-static-dbg — Installs ClickHouse compiled binary files with debug info.

    Attention

    If you need to install specific version of ClickHouse you have to install all packages with the same version:
    sudo apt-get install clickhouse-server=21.8.5.7 clickhouse-client=21.8.5.7 clickhouse-common-static=21.8.5.7

    From RPM Packages

    It is recommended to use official pre-compiled rpm packages for CentOS, RedHat, and all other rpm-based Linux distributions.

    First, you need to add the official repository:

    1. sudo yum install yum-utils
    2. sudo yum-config-manager --add-repo https://repo.clickhouse.tech/rpm/stable/x86_64

    If you want to use the most recent version, replace stable with testing (this is recommended for your testing environments). prestable is sometimes also available.

    Then run these commands to install packages:

    1. sudo yum install clickhouse-server clickhouse-client

    You can also download and install packages manually from here.

    The required version can be downloaded with curl or wget from repository .
    After that downloaded archives should be unpacked and installed with installation scripts. Example for the latest version:

    For production environments, it’s recommended to use the latest stable-version. You can find its number on GitHub page https://github.com/ClickHouse/ClickHouse/tags with postfix -stable.

    From Docker Image

    To run ClickHouse inside Docker follow the guide on Docker Hub. Those images use official deb packages inside.

    You can install ClickHouse on Linux using a single portable binary from the latest commit of the master branch: [].

    1. curl -O 'https://builds.clickhouse.tech/master/amd64/clickhouse' && chmod a+x clickhouse
    2. sudo ./clickhouse install

    From Precompiled Binaries for Non-Standard Environments

    For non-Linux operating systems and for AArch64 CPU arhitecture, ClickHouse builds are provided as a cross-compiled binary from the latest commit of the master branch (with a few hours delay).

    • curl -O 'https://builds.clickhouse.tech/master/macos/clickhouse' && chmod a+x ./clickhouse
    • MacOS Aarch64 (Apple Silicon)curl -O 'https://builds.clickhouse.tech/master/macos-aarch64/clickhouse' && chmod a+x ./clickhouse
    • curl -O 'https://builds.clickhouse.tech/master/freebsd/clickhouse' && chmod a+x ./clickhouse
    • Linux AArch64curl -O 'https://builds.clickhouse.tech/master/aarch64/clickhouse' && chmod a+x ./clickhouse

    After downloading, you can use the clickhouse client to connect to the server, or to process local data.

    Run sudo ./clickhouse install if you want to install clickhouse system-wide (also with needed configuration files, configuring users etc.). After that run clickhouse start commands to start the clickhouse-server and clickhouse-client to connect to it.

    These builds are not recommended for use in production environments because they are less thoroughly tested, but you can do so on your own risk. They also have only a subset of ClickHouse features available.

    To manually compile ClickHouse, follow the instructions for or Mac OS X.

    You can compile packages and install them or use programs without installing packages. Also by building manually you can disable SSE 4.2 requirement or build for AArch64 CPUs.

    1. Client: programs/clickhouse-client
    2. Server: programs/clickhouse-server

    You’ll need to create a data and metadata folders and chown them for the desired user. Their paths can be changed in server config (src/programs/server/config.xml), by default they are:

    1. /var/lib/clickhouse/data/default/
    2. /var/lib/clickhouse/metadata/default/

    On Gentoo, you can just use emerge clickhouse to install ClickHouse from sources.

    If you do not have service command, run as

    1. $ sudo /etc/init.d/clickhouse-server start

    See the logs in the /var/log/clickhouse-server/ directory.

    If the server does not start, check the configurations in the file /etc/clickhouse-server/config.xml.

    You can also manually launch the server from the console:

      In this case, the log will be printed to the console, which is convenient during development.
      If the configuration file is in the current directory, you do not need to specify the --config-file parameter. By default, it uses ./config.xml.

      ClickHouse supports access restriction settings. They are located in the users.xml file (next to config.xml).
      By default, access is allowed from anywhere for the default user, without a password. See user/default/networks.
      For more information, see the section .

      After launching server, you can use the command-line client to connect to it:

      1. $ clickhouse-client

      By default, it connects to localhost:9000 on behalf of the user without a password. It can also be used to connect to a remote server using --host argument.

      The terminal must use UTF-8 encoding.
      For more information, see the section “Command-line client”.

      Example:

      Congratulations, the system works!

      To continue experimenting, you can download one of the test data sets or go through .