
ClickHouse is a high-performance columnar database management system designed for analytics and fast query execution. Installing it locally is an excellent way to test and develop new features, enabling offline experimentation and controlled configurations. This guide focuses on native installations for different operating systems and Docker-based setups, ensuring flexibility for diverse user needs.
Why Local Installation of ClickHouse is Useful
Local installations provide developers and data engineers with a self-contained environment, ideal for:
- Testing Features: Experiment with new ClickHouse features or custom configurations without impacting production.
- Performance Benchmarking: Evaluate query performance on local datasets.
- Offline Development: Work with ClickHouse even in environments with limited internet access.
1. Native Installation
ClickHouse offers precompiled native builds for Linux, macOS, and Windows, making it easy to install directly on your operating system.
A. Linux
Add the ClickHouse Repository
Depending on your Linux distribution, add the official ClickHouse repository. For Ubuntu or Debian:
sudo apt-get install -y apt-transport-https ca-certificates dirmngr
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv E0C56BD4
echo "deb https://packages.clickhouse.com/deb stable main" | sudo tee /etc/apt/sources.list.d/clickhouse.list
sudo apt-get update
Install ClickHouse
sudo apt-get install -y clickhouse-server clickhouse-client
Start the ClickHouse Service
sudo service clickhouse-server start
Verify Installation
Launch the ClickHouse client:
clickhouse-client
Run a test query:
SELECT 1;
B. macOS
Install Using Homebrew
Ensure you have Homebrew installed. Then, run:
brew install clickhouse
Verify Installation
Start the ClickHouse client:
clickhouse-client
Test it with a query:
SELECT version();
C. Windows
Download the ClickHouse Build
Visit the official ClickHouse download page and download the latest .zip
release for Windows.
Extract and Configure
Unzip the package to a directory of your choice. The extracted folder contains clickhouse-server.exe
and clickhouse-client.exe
.
Run the Server
Open a command prompt in the extracted directory and start the server:
clickhouse-server
Access the Client
In another terminal, run the client:
clickhouse-client
Execute a query to ensure the setup works:
SELECT 1;
2. Docker Installation
For users who prefer containerized environments, Docker simplifies the setup and management of ClickHouse.
Pull the ClickHouse Image
docker pull yandex/clickhouse-server
Run the Container
docker run -d --name clickhouse-server -p 8123:8123 -p 9000:9000 yandex/clickhouse-server
Access the Client
Open the ClickHouse client inside the container:
docker exec -it clickhouse-server clickhouse-client
Test it by running:
SELECT version();
Managing and Verifying Installation
After installation, ensure ClickHouse runs efficiently with these steps:
Start/Stop Services
For native Linux installations:
sudo service clickhouse-server start
sudo service clickhouse-server stop
For Docker:
docker start clickhouse-server
docker stop clickhouse-server
Check Logs
Native installations: Logs are typically located in /var/log/clickhouse-server/
.
Docker:
docker logs clickhouse-server
Run Diagnostic Queries
Use system queries to monitor server health:
SELECT * FROM system.metrics;
Summary
Installing ClickHouse locally using its native builds or Docker provides developers with a versatile and robust environment for analytics and testing. Native installation ensures tight integration with your OS, while Docker offers portability and simplicity. By following the steps above, you’ll be ready to leverage ClickHouse’s powerful capabilities for local development and experimentation.
Last Releases
- Release v25.4.7.66-stableNo content. Source: https://github.com/ClickHouse/ClickHouse/releases/tag/v25.4.7.66-stable
- v25.7.1.1-newRelease v25.7.1.1-new Source: https://github.com/ClickHouse/ClickHouse/releases/tag/v25.7.1.1-new
- Release v25.4.6.67-stableNo content. Source: https://github.com/ClickHouse/ClickHouse/releases/tag/v25.4.6.67-stable