# How to install Apache Kafka on Windows without ZooKeeper (KRaft mode)

*Install and run Kafka in KRaft mode on Windows in 15 minutes*

KRaft mode runs Kafka without ZooKeeper, simplifying deployment and reducing resource requirements. This guide walks you through setting up a single-node KRaft cluster using WSL2.

**What you'll learn:**
- How to set up WSL2 on Windows
- How to generate a cluster ID and format storage
- How to start Kafka in KRaft mode
- How to configure your PATH for CLI access

> **Native Windows is not recommended**
> Kafka has known issues when running directly on Windows due to missing POSIX features. Always use WSL2 or [Docker](https://www.conduktor.io/kafka/how-to-start-kafka-using-docker) for Windows installations.

KRaft mode became production-ready in Kafka 3.3. For maximum compatibility with older tutorials and tools, see the [Windows ZooKeeper installation guide](https://www.conduktor.io/kafka/how-to-install-apache-kafka-on-windows).

## Installation overview

![Windows Kafka KRaft install flow: install WSL2, install Java 11, download Kafka, disable IPv6, generate cluster ID, format storage, start Kafka](https://www.conduktor.io/assets/kafka/diagrams/how-to-install-apache-kafka-on-windows-without-zookeeper-kraft-mode.svg)

```mermaid
flowchart LR
    A[Install WSL2] --> B[Install Java 11]
    B --> C[Download Kafka]
    C --> D[Disable IPv6]
    D --> E[Generate cluster ID]
    E --> F[Format storage]
    F --> G[Start Kafka]
```

## Step 1: Install WSL2

WSL2 provides a Linux environment on Windows without a virtual machine.

Open **PowerShell as Administrator** and run:

```powershell
wsl --install
```

This installs Ubuntu by default. Restart your computer when prompted.

After restart, open Ubuntu from the Start menu and create a Linux username and password.

> For troubleshooting WSL2 issues, see the [Microsoft troubleshooting guide](https://docs.microsoft.com/en-us/windows/wsl/troubleshooting).

## Step 2: Disable IPv6 on WSL2

WSL2 has a [networking issue](https://github.com/microsoft/WSL/issues/4851) that prevents external programs from connecting to Kafka. Disable IPv6 to fix this:

```bash
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
```

## Step 3: Install Java JDK 11

In your WSL2 Ubuntu terminal:

```bash
wget -O- https://apt.corretto.aws/corretto.key | sudo apt-key add -
sudo add-apt-repository 'deb https://apt.corretto.aws stable main'
sudo apt-get update
sudo apt-get install -y java-11-amazon-corretto-jdk
```

Verify the installation:

```bash
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 4: Download and extract Kafka

```bash
wget https://archive.apache.org/dist/kafka/3.0.0/kafka_2.13-3.0.0.tgz
tar -xzf kafka_2.13-3.0.0.tgz
mv kafka_2.13-3.0.0 ~
```

Or download manually from [kafka.apache.org/downloads](https://kafka.apache.org/downloads).

## Step 5: Generate cluster ID

KRaft clusters require a unique identifier:

```bash
~/kafka_2.13-3.0.0/bin/kafka-storage.sh random-uuid
```

This returns a UUID like `76BLQI7sT_ql1mBfKsOk9Q`. Save this value.

## Step 6: Format storage

Format the log directory using your cluster ID (replace `<uuid>` with your generated UUID):

```bash
~/kafka_2.13-3.0.0/bin/kafka-storage.sh format \
  -t <uuid> \
  -c ~/kafka_2.13-3.0.0/config/kraft/server.properties
```

This formats the directory specified in `log.dirs` (default: `/tmp/kraft-combined-logs`).

## Step 7: Start Kafka

```bash
~/kafka_2.13-3.0.0/bin/kafka-server-start.sh ~/kafka_2.13-3.0.0/config/kraft/server.properties
```

Keep this terminal window open. Kafka is now running at `localhost:9092` in KRaft mode.

## Step 8: Configure PATH

Add Kafka binaries to your PATH:

```bash
echo 'export PATH="$PATH:$HOME/kafka_2.13-3.0.0/bin"' >> ~/.bashrc
source ~/.bashrc
```

Verify the setup:

```bash
kafka-topics.sh --version
```

> **See it in practice with Conduktor**
> [Conduktor Console](https://docs.conduktor.io/guide/conduktor-in-production/admin/configure-clusters) can connect to your WSL2 KRaft cluster at `localhost:9092` from Windows for visual topic management.

## Next steps

- [CLI tutorials](https://www.conduktor.io/kafka/kafka-cli-tutorial) to create topics and produce messages
- [KRaft mode concepts](https://www.conduktor.io/kafka/kafka-kraft-mode) for deeper understanding
- [Windows ZooKeeper installation](https://www.conduktor.io/kafka/how-to-install-apache-kafka-on-windows) for traditional setup
