Kafka with KRaft (without Zookeeper) on Linux
- Install Java JDK version 11
- Download Apache Kafka v2.8+ from https://kafka.apache.org/downloads under Binary Downloads
- Extract the contents on Linux
- Generate a cluster ID and format the storage using kafka-storage.sh
- Start Kafka using the binaries
- Setup the $PATH environment variables for easy access to the Kafka binaries
Installing Java JDK 11
To install Apache Kafka on Linux, Java 11 is the only prerequisite.- Navigate to Amazon Corretto 11 Linux install page and follow the steps, which work for Debian, RPM, Alpine and Amazon Linux. Alternatively, you can download from the Amazon Corretto 11 download page and install the correct package for your Linux distribution (x64, aarch64, x86, arch32, etc…).
- For example on Ubuntu (Debian-based systems)
java -version
:
Install Apache Kafka
1. Download the latest version of Apache Kafka from https://kafka.apache.org/downloads under Binary downloads.
2.13-2.8.1
.
Alternatively you can run a wget command
~/kafka_2.13-2.8.1
.
~/kafka_2.13-2.8.1
directory.
Start Kafka
The first step is to generate a new ID for your cluster76BLQI7sT_ql1mBfKsOk9Q
Next, format your storage directory (replace <uuid>
by your UUID obtained above)
log.dirs
in the config/kraft/server.properties
file (by default /tmp/kraft-combined-logs
)
Now you can launch the broker itself in daemon mode by running this command.

Setup the $PATH environment variable
In order to easily access the Kafka binaries, you can edit your PATH variable by adding the following line to your system run commands (for example~/.zshrc
if you use zshrc):
PATH="$PATH:~/kafka_2.13-2.8.1/bin"
This ensures that you can now run the kafka commands without prefixing them.
After reloading your shell, the following should work from any directory