Skip to main content
Skip to main content

Install ClickHouse using tgz archives

It is recommended to use official pre-compiled tgz archives for all Linux distributions, where installation of deb or rpm packages isn't possible.

Review recommendations

Before installing ClickHouse, review the following recommendations:

  • Swap: Disable the operating system's swap file in production environments.
  • Disk space: The ClickHouse binary requires at least 2.5 GB of disk space for installation.
  • Network: For distributed deployments (clustering), use at least 10 Gbit network connectivity. Network bandwidth is critical for processing distributed queries with large amounts of intermediate data, as well as for replication.

Estimating storage requirements

To estimate the disk space needed for your data:

  1. Estimate data volume: Take a sample of your data and calculate the average row size, then multiply by the number of rows you plan to store.
  2. Apply the compression coefficient: Load a sample into ClickHouse and compare the original data size with the stored table size. Clickstream data, for example, is typically compressed 6-10x.
  3. Account for replicas: If you plan to store data in multiple replicas, multiply the estimated volume by the number of replicas.

For more detailed hardware requirements, see "Sizing and hardware recommendations"

Download and install the latest stable version

The required version can be downloaded with curl or wget from repository https://packages.clickhouse.com/tgz/. After that downloaded archives should be unpacked and installed with installation scripts.

Below is an example of how to install the latest stable version.

Note

For production environments, it's recommended to use the latest stable-version. You can find the release number on this GitHub page with postfix -stable.

Get the latest ClickHouse version

Get the latest ClickHouse version from GitHub and store it in LATEST_VERSION variable.

LATEST_VERSION=$(curl -s https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/utils/list-versions/version_date.tsv | \
    grep -Eo '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | sort -V -r | head -n 1)
export LATEST_VERSION

Detect your system architecture

Detect the system architecture and set the ARCH variable accordingly:

case $(uname -m) in
  x86_64) ARCH=amd64 ;;         # For Intel/AMD 64-bit processors
  aarch64) ARCH=arm64 ;;        # For ARM 64-bit processors
  *) echo "Unknown architecture $(uname -m)"; exit 1 ;; # Exit if architecture isn't supported
esac

Download tarballs for each ClickHouse component

Download tarballs for each ClickHouse component. The loop tries architecture-specific packages first, then falls back to generic ones.

for PKG in clickhouse-common-static clickhouse-common-static-dbg clickhouse-server clickhouse-client clickhouse-keeper
do
  curl -fO "https://packages.clickhouse.com/tgz/stable/$PKG-$LATEST_VERSION-${ARCH}.tgz" \
    || curl -fO "https://packages.clickhouse.com/tgz/stable/$PKG-$LATEST_VERSION.tgz"
done

Extract and install packages

Run the commands below to extract and install the following packages:

  • clickhouse-common-static
# Extract and install clickhouse-common-static package
tar -xzvf "clickhouse-common-static-$LATEST_VERSION-${ARCH}.tgz" \
  || tar -xzvf "clickhouse-common-static-$LATEST_VERSION.tgz"
sudo "clickhouse-common-static-$LATEST_VERSION/install/doinst.sh"
  • clickhouse-common-static-dbg
# Extract and install debug symbols package
tar -xzvf "clickhouse-common-static-dbg-$LATEST_VERSION-${ARCH}.tgz" \
  || tar -xzvf "clickhouse-common-static-dbg-$LATEST_VERSION.tgz"
sudo "clickhouse-common-static-dbg-$LATEST_VERSION/install/doinst.sh"
  • clickhouse-server
# Extract and install server package with configuration
tar -xzvf "clickhouse-server-$LATEST_VERSION-${ARCH}.tgz" \
  || tar -xzvf "clickhouse-server-$LATEST_VERSION.tgz"
sudo "clickhouse-server-$LATEST_VERSION/install/doinst.sh" configure
sudo /etc/init.d/clickhouse-server start  # Start the server
  • clickhouse-client
# Extract and install client package
tar -xzvf "clickhouse-client-$LATEST_VERSION-${ARCH}.tgz" \
  || tar -xzvf "clickhouse-client-$LATEST_VERSION.tgz"
sudo "clickhouse-client-$LATEST_VERSION/install/doinst.sh"