Methods of payment Abuse

How to install and use ClickHouse on Ubuntu 20.04

20.12.2022, 19:23

ClickHouse is a column–based database management system (DBMS for Big Data). In the step-by-step instructions, we will consider how to install the ClickHouse database management system on Ubuntu 20.04

Works at the start: how to prepare a virtual server for installing the ClickHouse database management system

Before installation, you will need to configure a virtual server to increase security:

create a user with root rights;
configure firewall startup;
update package indexes and packages themselves.

Setting standard commands:

$ sudo apt update

$ sudo apt upgrade

Installing the ClickHouse database management system

Before installing a DBMS, you need to roll up dependencies. We do this with the help of the command:

$ sudo apt install apt-transport-https ca-certificates dirmngr

When we have done this, we add the GPG-key repo and the repo itself to the system. When you have done this, you can install the ClickHouse database management system:

$ sudo apt install clickhouse-server clickhouse-client

The process takes a couple of minutes (the process can be observed in the console). During the installation, a password will be requested, which you will use in the future.

Launching ClickHouse to manage the database and tables

In order to start the system, use the command:

$ sudo service clickhouse-server start

If you specify the status command instead of start, you will get information about the status of the clickhouse-server service.

When the ClickHouse is launched, it remains to create a database and tables.

Making the first database (DB) using ClickHouse

To work with the service, a command line is provided in which the user enters commands. They should start with :)

For example, we want to create a database called bazadannyh. In this case, the command will look like

:) CREATE DATABASE bazadannyh;

To use it, you need to type in the command line:

:) USE bazadannyh.

To create a table in ClickHouse, enter the command:

CREATE TABLE table name

Pay attention to the syntax and valid types (in particular, val, id, and others).

The system supports the ability to insert new data, delete current data, update, and others. ClickHouse is also capable of processing requests.

Now you have on wirth. the server runs ClickHouse to create tables and databases. It remains only to use it correctly in the development process.