We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – How To Install ClickHouse analytic DBMS on Ubuntu 18.04 / CentOS 7

Learn how to – How To Install ClickHouse analytic DBMS on Ubuntu 18.04 / CentOS 7.

In this tutorial, we will cover the steps to install ClickHouse on Ubuntu 18.04 / CentOS 7. ClickHouse is a free and open-source column-oriented database management system that allows generating analytical data reports in real time.

ClickHouse is multi platform and can run on any Linux, FreeBSD or Mac OS X with x86_64 CPU architecture. Pre-compiled binary packages are available for quicker and clean installation.

Install ClickHouse on Ubuntu 18.04

For Ubuntu users, supported apt repository is available for use. Add it by running the commands below.

echo "deb http://repo.yandex.ru/clickhouse/deb/stable/ main/" | sudo tee /etc/apt/sources.list.d/clickhouse.list

Import GPG key:

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

Executing: /tmp/apt-key-gpghome.t6IDTPxi7M/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4
gpg: key C8F1E19FE0C56BD4: public key "ClickHouse Repository Key milovidov@yandex-team.ru" imported
gpg: Total number processed: 1
gpg: imported: 1

Then run these commands to install ClickHouse analytic DBMS:

sudo apt update
sudo apt -y install dirmngr clickhouse-server clickhouse-client

The ClickHouse configuration file is located in /etc/clickhouse-server/config.xml.

Start ClickHouse and set service to start at boot.

$ sudo systemctl enable  --now clickhouse-server.service
Synchronizing state of clickhouse-server.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable clickhouse-server

$ sudo systemctl is-enabled clickhouse-server.service
enabled

Confirm if the service is running:

$ systemctl status clickhouse-server.service 
● 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 Mon 2019-03-25 21:45:58 CET; 1min 40s ago
Main PID: 18406 (clickhouse-serv)
Tasks: 35 (limit: 4583)
CGroup: /system.slice/clickhouse-server.service
└─18406 /usr/bin/clickhouse-server --config=/etc/clickhouse-server/config.xml
Mar 25 21:45:58 ubuntu-4gb-nbg1-1 systemd[1]: Started ClickHouse Server (analytic DBMS for big data).
Mar 25 21:45:58 ubuntu-4gb-nbg1-1 clickhouse-server[18406]: Include not found: clickhouse_remote_servers
Mar 25 21:45:58 ubuntu-4gb-nbg1-1 clickhouse-server[18406]: Include not found: clickhouse_compression
Mar 25 21:45:58 ubuntu-4gb-nbg1-1 clickhouse-server[18406]: Logging trace to /var/log/clickhouse-server/clickhouse-server.log
Mar 25 21:45:58 ubuntu-4gb-nbg1-1 clickhouse-server[18406]: Logging errors to /var/log/clickhouse-server/clickhouse-server.err.log
Mar 25 21:45:58 ubuntu-4gb-nbg1-1 clickhouse-server[18406]: Include not found: networks
Mar 25 21:46:00 ubuntu-4gb-nbg1-1 clickhouse-server[18406]: Include not found: clickhouse_remote_servers
Mar 25 21:46:00 ubuntu-4gb-nbg1-1 clickhouse-server[18406]: Include not found: clickhouse_compression

If the server can’t start, check logs on /var/log/clickhouse-server/ when troubleshooting.

$ ls /var/log/clickhouse-server/
clickhouse-server.err.log clickhouse-server.log

Install ClickHouse on CentOS 7

For users running CentOS 7 server, you can do a scripted installation via packagecloud repository. Ensure curl is installed on your system.

sudo yum install -y curl

Run installer script to add Packagecloud repository to your CentOS 7 server.

curl -s https://packagecloud.io/install/repositories/altinity/clickhouse/script.rpm.sh | sudo bash

Confirm that ClickHouse packages are available for installation.

$ sudo yum list 'clickhouse*'

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.alpix.eu
 * extras: mirror.ratiokontakt.de
 * updates: mirror.checkdomain.de
Available Packages
clickhouse-client.x86_64                                                  19.4.1.3-1.el7                                            Altinity_clickhouse
clickhouse-common-static.x86_64                                           19.4.1.3-1.el7                                            Altinity_clickhouse
clickhouse-compressor.x86_64                                              1.1.54336-3.el7                                           Altinity_clickhouse
clickhouse-debuginfo.x86_64                                               18.14.15-1.el7                                            Altinity_clickhouse
clickhouse-mysql.noarch                                                   0.0.20180319-1                                            Altinity_clickhouse
clickhouse-odbc.x86_64                                                    20180903-1                                                Altinity_clickhouse
clickhouse-server.x86_64                                                  19.4.1.3-1.el7                                            Altinity_clickhouse
clickhouse-server-common.x86_64                                           19.4.1.3-1.el7                                            Altinity_clickhouse
clickhouse-test.x86_64                                                    19.4.1.3-1.el7                                           

Now install ClickHouse server and client applications

sudo yum install -y clickhouse-server clickhouse-client

Verify the packages are listed as installed

 sudo yum list installed 'clickhouse*'

Ensure ClickHouse server is started and set to start at server boot.

$ sudo systemctl start clickhouse-server
$ sudo systemctl enable clickhouse-server

clickhouse-server.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig clickhouse-server on

Check if the server is now running.

$ sudo systemctl status clickhouse-server
● clickhouse-server.service - LSB: Yandex clickhouse-server daemon
Loaded: loaded (/etc/rc.d/init.d/clickhouse-server; bad; vendor preset: disabled)
Active: active (running) since Mon 2019-03-25 22:07:22 CET; 1min 1s ago
Docs: man:systemd-sysv-generator(8)
Mar 25 22:07:21 centos-4gb-nbg1-1 systemd[1]: Starting LSB: Yandex clickhouse-server daemon…
Mar 25 22:07:21 centos-4gb-nbg1-1 su[12427]: (to clickhouse) root on none
Mar 25 22:07:21 centos-4gb-nbg1-1 clickhouse-server[12419]: Start clickhouse-server service: Path to data directory in /etc/clickhouse-server…khouse/
Mar 25 22:07:21 centos-4gb-nbg1-1 su[12432]: (to clickhouse) root on none
Mar 25 22:07:21 centos-4gb-nbg1-1 su[12434]: (to clickhouse) root on none
Mar 25 22:07:21 centos-4gb-nbg1-1 su[12440]: (to clickhouse) root on none
Mar 25 22:07:21 centos-4gb-nbg1-1 su[12445]: (to clickhouse) root on none
Mar 25 22:07:22 centos-4gb-nbg1-1 clickhouse-server[12419]: DONE
Mar 25 22:07:22 centos-4gb-nbg1-1 systemd[1]: Started LSB: Yandex clickhouse-server daemon.
Hint: Some lines were ellipsized, use -l to show in full.

Connect to ClickHouse server with clickhouse-client

After launching server, you can use the command-line client to connect to it:

$ clickhouse-client

ClickHouse client version 19.4.1.3.
Connecting to localhost:9000 as user default.
Connected to ClickHouse server version 19.4.1 revision 54416.
ubuntu-server :)

By default, it will connects to localhost:9000 as user default without a password. The client can also be used to connect to a remote server with --host argument.

ubuntu-server :) SELECT 1

SELECT 1

┌─1─┐
│ 1 │
└───┘

1 rows in set. Elapsed: 0.008 sec. 

ubuntu-server :) 

Congratulations, you have a working ClickHouse installation on Ubuntu 18.04 / CentOS 7. To get started, I recommend you go through ClickHouse tutorial and ClickHouse Documentation.

Other relevant articles:

How to Install pgAdmin 4 on CentOS 7 / Fedora 29 / Fedora 28

Install Hasura GraphQL Engine on Ubuntu 18.04 / CentOS 7

How to Install Latest phpMyAdmin on Ubuntu 18.04 / Debian 9

Install and Configure DBeaver on Ubuntu 18.04 / Ubuntu 16.04 / Debian 9

Install Dgraph on CentOS 7 / Ubuntu 18.04

Cart

Your Cart is Empty

Back To Shop