Overview

Install ClickHouse

You need a Linux or macOS machine with curl installed. To skip local installation entirely, start a Cloud service instead — it requires no install step.

Install with one command#

1
Download the binary

Run the install script. It detects your OS and CPU architecture and downloads the matching build:

curl https://clickhouse.com/ | sh

On Linux and macOS this also installs clickhousectl, the ClickHouse CLI, into ~/.local/bin with a chctl alias. To download only the clickhouse binary:

curl https://clickhouse.com/ | CLICKHOUSE_ONLY=1 sh
2
Try it without a server

Run the binary with no arguments to start clickhouse-local, which needs no configuration and stores data in a temporary directory:

./clickhouse

Tables created in clickhouse-local disappear when it exits. Use it to query files and test SQL, not to store data.

3
Start the server

Start a full server. It stores data in the current directory, so the data survives a restart:

./clickhouse server

To start the server with a configuration file, pass -C:

./clickhouse server -C config.xml
4
Connect with the client

In a second terminal, connect to the running server:

./clickhouse client

The client reports the version it connected to and opens a prompt:

ClickHouse client version 24.5.1.117 (official build).
Connecting to localhost:9000 as user default.
Connected to ClickHouse server version 24.5.1.
 
local-host :)

A prompt means the installation works.

Run in Docker#

Pull the official image and start a container. The --ulimit nofile setting raises the open-file limit, which ClickHouse needs for its column files:

docker pull clickhouse/clickhouse-server
docker run -d --name some-clickhouse-server --ulimit nofile=262144:262144 clickhouse/clickhouse-server

Connect the native client to the running container:

docker exec -it some-clickhouse-server clickhouse-client

To reach the container from your host, publish the ports and set a password. The default user has no network access until a password is set:

docker run -d -p 18123:8123 -p 19000:9000 -e CLICKHOUSE_PASSWORD=changeme \
  --name some-clickhouse-server --ulimit nofile=262144:262144 clickhouse/clickhouse-server
echo 'SELECT version()' | curl 'http://localhost:18123/?password=changeme' --data-binary @-

Image tags and CPU requirements#

latest tracks the newest release of the latest stable branch. A branch tag such as 22.2 tracks the newest release on that branch, and a full version such as 22.2.3.5 pins an exact release. Add -alpine for the smaller Alpine-based variant.

The amd64 image requires an x86-64-v3 CPU (AVX2, BMI1, BMI2, F16C, FMA, LZCNT, MOVBE, XSAVE) — virtually all x86 CPUs released after 2015. The arm64 image requires ARMv8.2-A with Load-Acquire RCpc, which covers AWS Graviton 2 and later, Azure, and GCP, but not Raspberry Pi 4 or Jetson AGX Xavier. Since version 24.11 the Ubuntu-based images require Docker 20.10.10 or newer.

Connect to ClickHouse Cloud#

The same client connects to a Cloud service over the secure native port, 9440. Both --secure and the port are required:

./clickhouse client \
  --host $CLICKHOUSE_HOST \
  --port 9440 \
  --user $CLICKHOUSE_USER \
  --password $CLICKHOUSE_PASSWORD \
  --secure \
  -q "SELECT 1"

Production installation#

For a server you intend to keep running, install from a package rather than the standalone binary: Debian and Ubuntu .deb packages, RedHat .rpm packages, NixOS, or a source build. Packages register a service, create a system user, and place configuration under /etc/clickhouse-server.

Next steps#

Updated

Was this page helpful?