<a id="systemd-ubuntu-debian-install"></a>

# Install Confluent Platform using Systemd on Ubuntu and Debian

Install a production-ready Confluent Platform configuration in a multi-node Ubuntu or Debian environment.

With this installation method, you connect to every node manually to run the Confluent Platform installation commands.

## Prerequisites

- You must complete these steps for each node in your cluster.
- Before installing Confluent Platform, your environment must meet the prerequisites as described in
  [software and hardware requirements](../system-requirements.md#system-requirements).

## Software package and repository retention policy

To maintain security and performance, Confluent enforces a retention policy for unsupported package versions, including RPM, Debian, and ZIP and TAR archives.
Confluent removes packages and repository metadata for versions that reach end of life (EOL).

If your Confluent Ansible playbooks target an EOL version, deployments fail after Confluent removes the packages from the repositories.
Migrate to a supported release regularly to ensure continued access to installation files and security updates.

## Get the software

To install Confluent Platform on Debian or Ubuntu, add the Confluent APT repository,
then install the `confluent-platform` package with `apt-get`. For
the community version, RBAC variant, or individual component packages,
see the [available packages reference](../available_packages.md#available-packages) or
search the repository with `apt-cache search <package-name>`.

1. Make a directory to store the Confluent public key used to sign Confluent packages
   in the APT repository.
   ```bash
   sudo mkdir -p /etc/apt/keyrings
   ```
2. Download and install the Confluent public key.
   ```bash
   wget -qO - https://packages.confluent.io/deb/8.3/archive.key | gpg \
   --dearmor | sudo tee /etc/apt/keyrings/confluent.gpg > /dev/null
   ```
3. Add the Confluent repository to `/etc/apt/sources.list.d` referencing the location
   of the signing key.

   #### ATTENTION
   Starting with Confluent Platform 8.0, the librdkafka, Avro, and libserdes C/C++ client packages
   will only be available in the `https://packages.confluent.io/clients` location.

   For the `clients` repository, you must obtain your Debian distribution’s
   release “Code Name”, such as `buster`, `focal`, or `jammy`.
   The following example uses `$(lsb_release -cs)`, which should work in most cases. If it does not, you
   must pick the closest [Debian](https://www.debian.org/releases/) or [Ubuntu](https://releases.ubuntu.com/) code name for your Debian Linux distribution
   that matches the [supported Debian & Ubuntu Operating Systems](../system-requirements.md#supported-os) supported by Confluent Platform.

   Use the following command to add the Confluent Platform and client repositories:
   ```bash
   CP_DIST=$(lsb_release -cs)
   echo "Types: deb
   URIs: https://packages.confluent.io/deb/8.3
   Suites: stable
   Components: main
   Architectures: $(dpkg --print-architecture)
   Signed-by: /etc/apt/keyrings/confluent.gpg

   Types: deb
   URIs: https://packages.confluent.io/clients/deb/
   Suites: ${CP_DIST}
   Components: main
   Architectures: $(dpkg --print-architecture)
   Signed-By: /etc/apt/keyrings/confluent.gpg" | sudo tee /etc/apt/sources.list.d/confluent-platform.sources > /dev/null
   ```
4. Update `apt-get` and install the entire Confluent Platform package.
   - Confluent Platform:
     ```bash
     sudo apt-get update && sudo apt-get install confluent-platform
     ```
   - Confluent Platform with [RBAC](../../security/authorization/rbac/overview.md#rbac-overview):
     ```bash
     sudo apt-get update && \
     sudo apt-get install confluent-platform && \
     sudo apt-get install confluent-security
     ```
   - Confluent Platform using only Confluent Community components:
     ```bash
     sudo apt-get update && sudo apt-get install confluent-community-2.13
     ```

## Configure Confluent Platform

Configure Confluent Platform with the individual component properties files. By default, these are located in `CONFLUENT_HOME/etc/`.
You must configure at least the following components.

<!-- kafka -->

### Kafka

For Kafka in KRaft mode, you must configure a node to be a broker or a controller.
In addition, you must create a unique cluster ID and format the log directories with that ID.

Typically in a production environment, you should have a minimum of three brokers and three controllers.

* Navigate to the KRaft configuration files located in the  `/etc/kafka/` directory. In this directory, you will find three sample property files for different node roles:
  - `broker.properties`: Use this file to configure a broker node.
  - `controller.properties`: Use this file to configure a controller node.
  - `server.properties`: Use this file to configure a node that runs in combined mode as both a broker and a controller. This mode is not supported for production environments.

  Choose the appropriate properties file for the node’s role in your KRaft cluster and then customize the settings in that file.
* Configure the `process.roles`, `node.id`, and `controller.quorum.bootstrap.servers` or `controller.quorum.voters` for each node.
  - For `process.roles`, set whether the node will be a `broker` or a `controller`. `combined` mode, meaning `process.roles` is set to
    `broker,controller`, is not supported for production use. Use it for experimentation only.
  - Set a system-wide unique ID for the `node.id` for each broker/controller.
  - On Confluent Platform 7.9.x and later, you can use either a dynamic controller quorum or a static controller quorum.
    Unless you have a specific reason to use a static quorum, use a dynamic quorum, which allows you to
    add or replace controllers without cluster reconfiguration.

    **Dynamic quorum example — recommended for Confluent Platform 7.9.x and later:**
    ```bash
    ############################# Server Basics #############################

    # The role of this server. Setting this puts us in KRaft mode
    process.roles=broker

    # The node id associated with this instance's roles
    node.id=2

    # The connect string for the controller quorum
    controller.quorum.bootstrap.servers=controller1:9093,controller2:9093,controller3:9093
    ```

    **Static quorum example — alternative:**
    ```bash
    ############################# Server Basics #############################

    # The role of this server. Setting this puts us in KRaft mode
    process.roles=broker

    # The node id associated with this instance's roles
    node.id=2

    # The connect string for the controller quorum
    controller.quorum.voters=1@controller1:9093,3@controller2:9093,5@controller3:9093
    ```
* Configure how brokers and clients communicate with the broker using `listeners`, and where controllers listen with
  `controller.listener.names`.
  - `listeners`: Comma-separated list of URIs and listener names to listen on in the format `listener_name://host_name:port`
  - `controller.listener.names`: Comma-separated list of `listener_name` entries for listeners used by the controller.

  For more information, see [KRaft Configuration for Confluent Platform](../../kafka-metadata/config-kraft.md#configure-kraft).
* Configure security for your environment.
  - For general security guidance, see [KRaft Security in Confluent Platform](../../security/component/kraft-security.md#kraft-security).
  - For role-based access control (RBAC), see [Configure Metadata Service (MDS) in Confluent Platform](../../kafka/configure-mds/index.md#rbac-mds-config).
  - For configuring SASL/SCRAM for broker-to-broker communication, see [KRaft-based Confluent Platform clusters](../../security/authentication/sasl/scram/overview.md#sasl-scram-kraft-based-clusters).

#### Schema Registry

<!-- configuration Schema Registry -->

Navigate to the Schema Registry properties file (`/etc/schema-registry/schema-registry.properties`)
and specify the following properties:

```none
# Specify the address the socket server listens on, e.g. listeners = PLAINTEXT://your.host.name:9092
listeners=http://0.0.0.0:8081

# The advertised host name. This must be specified if you are running Schema Registry
# with multiple nodes.
host.name=192.168.50.1

# List of Kafka brokers to connect to, e.g. PLAINTEXT://hostname:9092,SSL://hostname2:9092
kafkastore.bootstrap.servers=PLAINTEXT://hostname:9092,SSL://hostname2:9092
```

This is a sample configuration for a three-node cluster. For more information, see [Deploy Schema Registry in Production on Confluent Platform](../../schema-registry/installation/deployment.md#schema-registry-prod).

#### REST Proxy

If you are using a Confluent Enterprise license, navigate to the REST Proxy properties file (`/etc/kafka-rest/rest-proxy.properties`)
and specify the following property:

```bash
kafka.rest.resource.extension.class=io.confluent.kafkarest.security.KafkaRestSecurityResourceExtension
```

## Start Confluent Platform

<!-- systemd installation shared between RHEL/CENTOS/UBUNTU/DEBIAN -->

Start Confluent Platform and its components using systemd service unit files. You can start immediately by using the
`systemctl start` command or enable for automatic startup by using the `systemctl enable` command. These instructions
use the syntax for immediate startup.

Start your KRaft controllers first, then Kafka brokers, and then start Schema Registry before any other components.

1. Before you start Kafka, you must use the [kafka-storage](/kafka/operations-tools/kafka-tools.html#kafka-storage-sh) tool with the `random-uuid` command
   to generate a cluster ID for each new cluster. You only need one cluster ID, which you will use to format
   each node in the cluster.
   ```none
   bin/kafka-storage random-uuid
   ```

   This results in output like the following:
   ```none
   q1Sh-9_ISia_zwGINzRvyQ
   ```

   Then use the cluster ID to format storage for each node in the cluster with the `kafka-storage` tool that is provided with Confluent Platform,
   and the `format` command like the following example, specifying the properties file for a controller.
   ```none
   bin/kafka-storage format -t q1Sh-9_ISia_zwGINzRvyQ -c etc/kafka/controller.properties
   ```

   Previously, Kafka would format blank storage directories automatically and generate a new cluster ID automatically.
   One reason for the change is that auto-formatting can sometimes obscure an
   error condition. This is particularly important for the metadata log maintained by the controller and broker servers.
   If a majority of the controllers were able to start with an empty log directory, a leader might be able to be elected with
   missing committed data. To configure the log directory, either set `metadata.log.dir` or `log.dirs`. For more
   information, see [Inter-broker listeners](../../kafka-metadata/config-kraft.md#kraft-log-settings).
2. Start Kafka (controllers and then brokers)
   - Confluent Platform:
     ```bash
     sudo systemctl start confluent-server
     ```
   - Confluent Platform using only Confluent Community components:
     ```bash
     sudo systemctl start confluent-kafka
     ```
3. Start Schema Registry.
   ```bash
   sudo systemctl start confluent-schema-registry
   ```
4. Start other Confluent Platform components as desired.
   - Kafka Connect
     ```bash
     sudo systemctl start confluent-kafka-connect
     ```
   - Confluent REST Proxy
     ```bash
     sudo systemctl start confluent-kafka-rest
     ```
   - ksqlDB
     ```bash
     sudo systemctl start confluent-ksqldb
     ```

## Uninstall

Run this command to remove Confluent Platform, where `<component-name>` is either `confluent-platform`
(Confluent Platform) or `confluent-community-2.13` (Confluent Platform using only Confluent Community components).

```bash
sudo apt-get remove <component-name>
```

For example, run this command to remove Confluent Platform:

```bash
sudo apt-get remove confluent-platform
```

## Related content

- [Install Control Center](/control-center/current/installation/overview.html)
- [Confluent Platform and Apache Kafka compatibility](../versions-interoperability.md#cp-ak-compatibility)
- [Quick Start for Confluent Platform](../../get-started/platform-quickstart.md#quickstart).
- [Use Confluent Platform systemd Service Unit Files](scripted-install.md#installing-systemd-unit)
- [Install Confluent Platform using Systemd on RHEL, CentOS, and Fedora-based Linux](rhel-centos.md#systemd-rhel-centos-install)
- [Install Confluent Platform using ZIP and TAR Archives](zip-tar.md#prod-kafka-cli-install)
- [Install Confluent Platform Using Docker](../docker/installation.md#cpdocker-intro)
