In this tutorial, we will explain the steps of installing ClickHouse on a Debian 9 VPS.

ClickHouse is a free and open-source DBMS (columnar database management system) developed by Yandex. With ClickHouse, users can manage very large volumes of data, including non-aggregated data, and generate data reports in real time – and it can do all of this pretty quickly, too. It is able to process hundreds of millions of data entries per second on a server. The system is linearly scalable and can be scaled up to store and process trillions of rows and petabytes of data.  The installation process is pretty easy and straightforward, and it can be done in less than 10 minutes. Let’s get started.

ClickHouse comes with a lot of useful features. Some of them are listed below:

  • True Column-Oriented DBMS
  • Data Compression
  • Disk Storage of Data
  • Parallel Processing on Multiple Cores
  • Distributed Processing on Multiple Servers
  • SQL Support
  • Vector Engine
  • Real-time Data Updates
  • Suitable for Online Queries
  • Support for Approximated Calculations
  • Data replication and data integrity support

and much more …

Prerequisites

  • a server or VPS running Debian 9 with SSH access and at least 4 GB of RAM. For the purposes of this tutorial, we will use one of our SSD Debian VPS hosting plans (SSD 4 to be exact).
  • System user with root privileges, or access to the root user. All of our VPS hosting plans come with full root access.

Step 1: Log in and Update the Server

In order to start with the ClickHouse installation, we have to log in to the Debian 9 VPS via SSH as the root user.

ssh [email protected]IP_address -p Port_number

Make sure to replace “IP_address” and “Port_number” with their respective values for your server.

After you log in, run the following command to make sure that all installed packages on your Debian 9 VPS are updated to their latest available versions:

apt update && apt upgrade

Step 2: Install ClickHouse

ClickHouse can be installed in several different ways. You can compile the code for your server from the source code, but in this tutorial we will guide you through the steps of installing it from Yandex’s official pre-compiled .deb package. This is the recommended way of installing this application. The first step of the ClickHouse installation is to add Yandex’s official repository to your server. To do that, create a ‘clickhouse.list’ file at the path /etc/apt/sources.list.d/ with the following content:

nano /etc/apt/sources.list.d/clickhouse.list
deb http://repo.yandex.ru/clickhouse/deb/stable/ main/

After you save and exit the file, add the repository key so that you can download the ClickHouse package securely:

apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4

Once that’s done, update the repositories list:

apt update

Finally, run the following command to install ClickHouse server and client on your Debian 9 VPS:

apt-get install clickhouse-client clickhouse-server

We’re installing both the client and the server, as the client allows you to access and manage the server through the command line.

Once the installation is completed, start the ClickHouse server and enable it to automatically start upon a server reboot:

systemctl start clickhouse-server
ystemctl enable clickhouse-server

You can check if the ClickHouse server is up and running by checking its status through systemctl:

systemctl status clickhouse-server

The output should show that it’s running, much like the output shows here:

clickhouse-server.service - ClickHouse Server (analytic DBMS for big data)
   Loaded: loaded (/etc/systemd/system/clickhouse-server.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2019-06-18 12:16:07 EDT; 9s ago
 Main PID: 1027 (clickhouse-serv)
    Tasks: 36 (limit: 4915)
   CGroup: /system.slice/clickhouse-server.service
           ââ1027 /usr/bin/clickhouse-server --config=/etc/clickhouse-server/config.xml --pid-file=/run/clickhouse-server/clickhouse-server.pid

Jun 18 12:16:07 for-blog-post.rosehostingtest.com systemd[1]: Started ClickHouse Server (analytic DBMS for big data).
Jun 18 12:16:07 for-blog-post.rosehostingtest.com clickhouse-server[1027]: Include not found: clickhouse_remote_servers
Jun 18 12:16:07 for-blog-post.rosehostingtest.com clickhouse-server[1027]: Include not found: clickhouse_compression
Jun 18 12:16:07 for-blog-post.rosehostingtest.com clickhouse-server[1027]: Logging trace to /var/log/clickhouse-server/clickhouse-server.log
Jun 18 12:16:07 for-blog-post.rosehostingtest.com clickhouse-server[1027]: Logging errors to /var/log/clickhouse-server/clickhouse-server.err.log
Jun 18 12:16:07 for-blog-post.rosehostingtest.com clickhouse-server[1027]: Include not found: networks
Jun 18 12:16:09 for-blog-post.rosehostingtest.com clickhouse-server[1027]: Include not found: clickhouse_remote_servers
Jun 18 12:16:09 for-blog-post.rosehostingtest.com clickhouse-server[1027]: Include not found: clickhouse_compression

We have successfully installed the stable release of ClickHouse on the server. To check the version that was installed onto your server, issue the following command:

clickhouse-server --V
ClickHouse server version 19.8.3.8 (official build).

At the moment of writing this tutorial, it is version 19.8.3.8. If you want to install and use a newer release of ClickHouse, replace stable with testing in the /etc/apt/sources.list.d/clickhouse.list file. It should look like the following:

deb http://repo.yandex.ru/clickhouse/deb/testing/ main/

That’s all! ClickHouse is now successfully installed on your Debian 9 VPS and is ready to use. ClickHouse listens on localhost on port 9000 by default. You can log into the ClickHouse server using the ClickHouse client through the command line interface, as shown below:

clickhouse-client
ClickHouse client version 19.8.3.8 (official build).
Connecting to localhost:9000 as user default.

If you need more details on ClickHouse or you need to learn how to get started, please visit their official documentation.


Of course, you don’t have to install ClickHouse on Debian 9 if you use one of our Managed Debian Hosting services, in which case you can simply ask our expert system administrators to install ClickHouse for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post on how to install ClickHouse on Debian 9, please share it with your friends on the social networks by using the share shortcuts below, or simply leave a comment in the comments section. Thanks.