Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Install ClickHouse on Ubuntu

Add the official ClickHouse repository, install the server and client, and connect.

Databases2 min read8 screenshots

About ClickHouse

ClickHouse is a fast, open-source, column-oriented database for analytics. It handles large amounts of data and runs complex queries quickly.

Requirements

  • OS: Ubuntu 20.04 or later.
  • CPU: a modern multi-core processor with SSE 4.2 support.
  • RAM: at least 2 GB (more for big data sets).
  • Storage: enough disk space for your data. SSDs are best.
  • Optional: clients for MySQL, PostgreSQL or Redis if you want to read from those systems, and Python for tools and libraries.

Step 1: Install the dependencies

sudo apt-get install -y apt-transport-https ca-certificates curl gnupg
Installing the dependencies

Step 2: Add the repository key

curl -fsSL 'https://packages.clickhouse.com/rpm/lts/repodata/repomd.xml.key' | sudo gpg --dearmor -o /usr/share/keyrings/clickhouse-keyring.gpg
Adding the repository key

Step 3: Add the repository

echo "deb [signed-by=/usr/share/keyrings/clickhouse-keyring.gpg] https://packages.clickhouse.com/deb stable main" | sudo tee /etc/apt/sources.list.d/clickhouse.list
Adding the ClickHouse repository

Step 4: Update the package list

sudo apt-get update
Updating the package list

Step 5: Install the server and the client

sudo apt-get install -y clickhouse-server clickhouse-client
Installing ClickHouse

During the install, you are asked for a password for the default user. Choose a strong one.

Setting the password for the default user

Step 6: Start the server and the client

sudo clickhouse start
Starting the server

(You can also use sudo service clickhouse-server start.)

Connect with the client and enter your password:

clickhouse-client --password
Connecting with clickhouse-client

Try a first query:

SELECT version();

After the install

  • Configuration. The main files are /etc/clickhouse-server/config.xml and /etc/clickhouse-server/users.xml. Put your own changes in the config.d and users.d folders.
  • Security. Set a strong password for the default user, create users with limited rights, and use TLS (set it in config.xml).
  • Firewall. Do not open ports 8123 (HTTP) and 9000 (native) to the whole internet.
  • Updates. Update the package often for security fixes.

Quick recap

  • Add the ClickHouse repository and key.
  • sudo apt-get install -y clickhouse-server clickhouse-client.
  • Start with sudo clickhouse start and connect with clickhouse-client --password.