How to install Apache Kafka on Linux

Install Kafka on Linux step by step. Set up Java, download Kafka with wget, start ZooKeeper and the broker, and run a CLI smoke test on your cluster.

By Stéphane Derosiaux · Updated October 16, 2026

Install and run Kafka on Linux

This guide walks you through installing Apache Kafka with ZooKeeper on Linux. By the end, you'll have a working single-node Kafka cluster for development.

What you'll learn:

  • How to install Java 11 (required dependency)
  • How to download and configure Kafka
  • How to start ZooKeeper and Kafka
  • How to set up your PATH for CLI access

Legacy setup: ZooKeeper was removed in Kafka 4.0

This guide runs Kafka 3.9.2, the last release line that supports ZooKeeper. For a new setup, follow the Linux KRaft installation guide instead.

Installation overview

Linux Kafka install flow: install Java 11, download Kafka, start ZooKeeper, start Kafka, configure PATH

Step 1: Install Java JDK 11

Kafka requires Java 11 or later.

For Ubuntu/Debian:

wget -O - https://apt.corretto.aws/corretto.key | sudo gpg --dearmor -o /usr/share/keyrings/corretto-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/corretto-keyring.gpg] https://apt.corretto.aws stable main" | sudo tee /etc/apt/sources.list.d/corretto.list
sudo apt-get update
sudo apt-get install -y java-11-amazon-corretto-jdk

For other distributions:

Visit the Amazon Corretto 11 Linux install page for RPM, Alpine, and other packages.

Verify the installation:

java -version

Expected output:

openjdk version "11.0.10" 2021-01-19 LTS
OpenJDK Runtime Environment Corretto-11.0.10.9.1 (build 11.0.10+9-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.10.9.1 (build 11.0.10+9-LTS, mixed mode)

Step 2: Download and extract Kafka

Download Kafka 3.9.2 (Scala 2.13 binary) into your home directory:

cd ~
wget https://archive.apache.org/dist/kafka/3.9.2/kafka_2.13-3.9.2.tgz
tar -xzf kafka_2.13-3.9.2.tgz

Don't pick the latest release on kafka.apache.org/downloads: Kafka 4.x no longer includes ZooKeeper, so the commands below won't work with it.

Step 3: Start ZooKeeper

ZooKeeper has to be running before Kafka starts.

Open a terminal and run:

~/kafka_2.13-3.9.2/bin/zookeeper-server-start.sh ~/kafka_2.13-3.9.2/config/zookeeper.properties

Add the -daemon flag to run ZooKeeper in the background.

Keep this terminal window open.

Step 4: Start Kafka

Open a new terminal window and run:

~/kafka_2.13-3.9.2/bin/kafka-server-start.sh ~/kafka_2.13-3.9.2/config/server.properties

Keep this terminal window open. Kafka is now running at localhost:9092.

Step 5: Configure PATH

Add Kafka binaries to your PATH for convenient access.

Edit your shell configuration file (~/.bashrc or ~/.zshrc):

export PATH="$PATH:$HOME/kafka_2.13-3.9.2/bin"

Reload your shell:

source ~/.bashrc

Verify the setup:

kafka-topics.sh --version

Optional: Change data directories

By default, Kafka stores data in /tmp, which may be cleared on restart.

Change ZooKeeper data directory:

Edit ~/kafka_2.13-3.9.2/config/zookeeper.properties:

dataDir=/your/path/to/data/zookeeper

Change Kafka data directory:

Edit ~/kafka_2.13-3.9.2/config/server.properties:

log.dirs=/your/path/to/data/kafka

See it in practice with Conduktor

Conduktor Console can connect to your local Kafka cluster at localhost:9092 for visual topic management.

Next steps