Methods of payment Abuse

How to install and use ClickHouse on Ubuntu 20.04

20.12.2022, 19:23

ClickHouse is a columnar database management system (DBMS for Big Data). In this step-by-step instruction, let's see how to install ClickHouse DataBase management system on Ubuntu 20.04.

Getting Started: How to Prepare a Virtual Server for Installing ClickHouse DataBase Management System

Before installation, you will need to configure the virtual server to improve security:

  • create a root-authorized user;
  • configure the firewall to run;
  • update package indexes and packages themselves.

Define standard commands:

$ sudo apt update
$ sudo apt upgrade

Installing ClickHouse Database Management System

Before installing DBMS, you need to roll dependencies. Do this using the command:

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

When done, add the GPG-keyrepo 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 minutes (you can watch the process in the console). During the installation, you will be asked for a password that you will use in the future.

Starting ClickHouse for database and table management

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.

Once ClickHouse is up and running, what remains is to create a database and tables.

Making the first database using ClickHouse

To work with the service provides a command line, 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 must type in the command line:

:) USE bazadannyh.

To create a table in ClickHouse, you must type the command:

CREATE TABLE table_name

Pay attention to the syntax and allowable 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 ClickHouse working on your virtual server to create tables and databases. All that remains is to use it correctly in the development process.