02.07.2026

Initial ClickHouse Configuration After Installation: A Step-by-Step Guide

After installing ClickHouse via One-Click Apps, the server is essentially ready to use. However, before importing data or connecting applications, it is recommended to perform a basic initial configuration. This improves security, verifies that the server is working correctly, and prepares it for production use.

Step 1. Connect to the server

Connect to the virtual machine via SSH:

ssh root@YOUR_SERVER_IP

Make sure the ClickHouse service is running:

sudo systemctl status clickhouse-server

If the service is working correctly, you will see the status:

active (running)

Step 2. Verify the database connection

Launch the ClickHouse client:

clickhouse-client

Check the connection with a simple query:

SELECT version();

You can also check the current server time:

SELECT now();

If both queries execute successfully, the server is fully ready to use.

Step 2.1. Check system resources and disk usage

Before working with ClickHouse, it is important to verify that the server has enough available resources for analytical workloads. ClickHouse is highly dependent on disk speed, memory, and CPU performance.

Check overall system usage:

htop

Check disk space:

df -h

Check memory usage:

free -h

ClickHouse performs best when there is sufficient free RAM for caching and fast disk I/O. If resources are limited, consider optimizing table engines or adjusting server limits in configuration files.

Step 3. Create a separate database

It is not recommended to store user tables in the system database default.

Create a dedicated database:

CREATE DATABASE analytics;

Check the list of databases:

SHOW DATABASES;

Switch to the new database:

USE analytics;

Step 4. Create the first user

By default, ClickHouse uses the default user. For production environments, it is recommended to create a separate account with restricted permissions.

For example, you can create a user via SQL:

CREATE USER analyst IDENTIFIED BY 'StrongPassword123!';

Grant access to the new database:

GRANT ALL ON analytics.* TO analyst;

This ensures that the administrator account is not used for daily operations.

Step 4.1. Configure basic security settings

For production environments, it is recommended to strengthen ClickHouse security beyond default settings. This includes restricting access to the server and disabling unnecessary endpoints.

You can disable remote access for the default user by editing the user configuration file:

sudo nano /etc/clickhouse-server/users.xml

Set or update limits such as IP restrictions or password rules.

Example of restricting access to localhost only:

::1
127.0.0.1

After changes, restart ClickHouse:

sudo systemctl restart clickhouse-server

This step helps reduce the risk of unauthorized access and improves overall server security.

Step 5. Enable remote connections (if needed)

If external applications or BI systems will connect to ClickHouse, make sure the server is listening on external interfaces.

Check the listen_host parameter:

sudo nano /etc/clickhouse-server/config.xml

Find the line:

::

If it is missing, add it to the server configuration section.

After making changes, restart the service:

sudo systemctl restart clickhouse-server

Step 6. Open required ports

If UFW is enabled, allow incoming connections:

sudo ufw allow 9000/tcp
sudo ufw allow 8123/tcp

sudo ufw reload

Port 9000 is used by most ClickHouse clients, while 8123 is used for the HTTP API.

Step 7. Create your first table

To test the setup, create a sample table:

CREATE TABLE analytics.events
(
id UInt64,
event String,
created_at DateTime
)
ENGINE = MergeTree
ORDER BY id;

Verify that the table was created:

SHOW TABLES;

Step 8. Insert test data

Insert a few records:

INSERT INTO analytics.events VALUES
(1,'Server started',now()),
(2,'Database configured',now());

Check the table contents:

SELECT * FROM analytics.events;

If the records are displayed, the installation and initial setup were completed successfully.

Step 7.1. Optimize table design for better performance

When working with ClickHouse, table structure has a significant impact on query performance. Choosing the correct primary key and sorting strategy is essential for large datasets.

Instead of only using a simple ORDER BY clause, consider designing tables based on query patterns. For example, if most queries filter by date, it is better to include a time-based sorting key:

CREATE TABLE analytics.events
(
id UInt64,
event String,
created_at DateTime
)
ENGINE = MergeTree
ORDER BY (created_at, id);

For even better performance on large datasets, you can also add partitioning by date:

PARTITION BY toYYYYMM(created_at)

Proper table design reduces query time, improves compression efficiency, and helps ClickHouse scale more effectively with growing data volumes.

Recommended next steps

After the basic configuration, it is recommended to perform additional server setup:

After completing these steps, ClickHouse is fully ready for storing and analyzing large volumes of data, as well as integrating with analytics systems, applications, and monitoring services.

Deploy ClickHouse and other services in one click with Serverspace

With Serverspace you can significantly speed up the deployment of your infrastructure using ready-made One-Click Apps. Instead of manually installing and configuring databases, frameworks, or server tools, you can launch a fully working environment in just a few minutes.

Serverspace provides a wide range of preconfigured applications, including ClickHouse, PostgreSQL, MySQL, Redis, Docker, and many others. This allows you to focus on development and data processing instead of routine server setup.

Key advantages of One-Click Apps:

Using One-Click Apps is especially useful for developers, DevOps engineers, and startups that need to quickly prototype or deploy production-ready services without deep infrastructure management.

You can explore available solutions and deploy your server directly on the Serverspace

FAQ

Does ClickHouse work on Ubuntu 22.04?

Yes, ClickHouse fully supports Ubuntu 22.04 (LTS), and this version is widely used in production environments.

What is the most reliable way to install ClickHouse on Ubuntu 22.04?

It is recommended to install it via the official ClickHouse APT repository, as it provides up-to-date stable releases and easy upgrades.

Is additional configuration required after installing ClickHouse?

Yes, after installation it is usually necessary to configure users, access permissions, memory limits, and settings in /etc/clickhouse-server/.

Can ClickHouse be used on a VPS with 1–2 GB RAM?

Technically yes, but for stable performance at least 4 GB of RAM is recommended, especially for analytical workloads.

How can I check if ClickHouse is running correctly?

You can use the clickhouse-client command or check the service status via systemctl status clickhouse-server.

Is ClickHouse suitable for small projects?

Yes, but its full potential is realized in large-scale analytics. For simple CRUD workloads, PostgreSQL or MySQL are often better choices.