Skip to main content
Skip to main content

Install ClickHouse on NixOS

ClickHouse is available in the Nixpkgs repository and can be installed using Nix on Linux and macOS.

Install ClickHouse using Nix

You can use Nix to install ClickHouse without permanently adding it to your system:

# Install the latest stable version
nix shell nixpkgs#clickhouse

# Or install the LTS version
nix shell nixpkgs#clickhouse-lts

This will make the clickhouse binary available in your current shell session.

  • The nixpkgs#clickhouse package provides the latest stable version.
  • The nixpkgs#clickhouse-lts package provides the Long Term Support version.
  • Both packages work on Linux and macOS.

Permanent Installation

To install ClickHouse permanently on your system:

For NixOS users, add to your configuration.nix:

environment.systemPackages = with pkgs; [
  clickhouse
];

Then rebuild your system:

sudo nixos-rebuild switch

For non-NixOS users, install using Nix profile:

# Install the latest stable version
nix profile install nixpkgs#clickhouse

# Or install the LTS version
nix profile install nixpkgs#clickhouse-lts

Start ClickHouse Server

After installation, you can start the ClickHouse server:

clickhouse-server

By default, the server will start with a basic configuration and listen on localhost:9000.

For production use on NixOS, you may want to configure ClickHouse as a system service. Refer to the NixOS manual for available configuration options.

Start ClickHouse Client

To connect to the ClickHouse server, open a new terminal and run:

clickhouse-client

About the Nix Package

The ClickHouse package in Nixpkgs includes:

  • clickhouse-server - The ClickHouse database server
  • clickhouse-client - The command-line client for connecting to ClickHouse
  • clickhouse-local - A tool for running SQL queries on local files
  • Other ClickHouse utilities

For more information about the ClickHouse package in Nixpkgs, visit: