Table of Contents
ClickHouse is a high-performance, column-oriented database built for analytics, logs, metrics, and real-time queries. Debian is one of the best environments for running ClickHouse because of its stability and clean package management.
Step 1: Update System Packages
Start with a clean and updated system.
sudo apt update && sudo apt upgrade -y
Step 2: Install Required Dependencies
ClickHouse uses HTTPS repositories and GPG verification.
sudo apt install -y apt-transport-https ca-certificates curl gnupg
Step 3: Add the ClickHouse GPG Key
Import the official signing key:
curl -fsSL https://packages.clickhouse.com/CLICKHOUSE-KEY.GPG | sudo gpg --dearmor -o /usr/share/keyrings/clickhouse.gpg
Step 4: Add the ClickHouse Repository
Create the repository source file:
echo "deb [signed-by=/usr/share/keyrings/clickhouse.gpg] https://packages.clickhouse.com/deb stable main" | sudo tee /etc/apt/sources.list.d/clickhouse.list
Update package lists:
sudo apt update
Step 5: Install ClickHouse Server and Client
Install both the server and CLI tools:
sudo apt install -y clickhouse-server clickhouse-client
Step 6: Start and Enable ClickHouse Service
Enable ClickHouse at boot and start it immediately:
sudo systemctl enable --now clickhouse-server
Check service status:
systemctl status clickhouse-server
You should see active (running).
Step 7: Connect to ClickHouse
Access the ClickHouse client:
clickhouse-client
Test the installation:
SELECT version();
If a version is returned, ClickHouse is working correctly.
Step 8: Allow Remote Connections (Optional)
By default, ClickHouse only listens on localhost.
Edit the config file:
sudo nano /etc/clickhouse-server/config.xml
Find and modify:
<listen_host>::</listen_host>
Restart ClickHouse:
sudo systemctl restart clickhouse-server
If UFW is enabled, open the native TCP port:
sudo ufw allow 9000/tcp
ClickHouse is not a replacement for MySQL or PostgreSQL. Use it where it shines: analytics, time-series data, logs, metrics, and massive read-heavy workloads. If you try to use it like a transactional database, you’re using the wrong tool.
