Installing and Running Kafka on Windows - lydtechconsulting/introduction-to-kafka-with-spring-boot GitHub Wiki

Introduction

It is possible to install and run Kafka on a Microsoft Windows machine using the Windows Subsystem for Linux (WSL). We recommend using WSL2 on Windows 10 (Build 19041 or above) or Windows 11.

To run Kafka on Windows you will need to :

  • Install WSL2
  • Install Java
  • Install Kafka

Installing WSL2

Details on installing WSL can be found on the Microsoft WSL website

Note: When installing WSL make sure you are using a Powershell window that is running as Administrator

By default WSL will install the Ubuntu distro, so the following commands refer to Ubuntu specifically. If you installed a different linux distro then you will need to make adjustments to the following based on the distro being used.

Installing Java

Having installed WSL start an Ubuntu terminal window.

First ensure that the linux packages are up to date using:

sudo apt update

Next install Java 17 using:

sudo apt install openjdk-17-jdk

Installing Kafka

To install Kafka first download the Kafka release archive. As per the course tutorial just download the latest available version.

You can download the Kafka release via a browser or alternatively use wget to download the release to your current directory:

cd ~

wget https://archive.apache.org/dist/kafka/3.6.0/kafka_2.13-3.6.0.tgz

Now install the downloaded release to a suitable directory. The following instructions are basically now the same as in the course tutorial with a few minor changes for the latest Kafka version and the downloaded release file location.

mkdir -p ~/tools/kafka

cd ~/tools/kafka

tar -xvf ~/kafka_2.13-3.6.0.tgz

Starting the Kafka Broker and sending and receiving a message

The instructions for starting the Kafka broker and sending and receiving messages are the same as detailed in the course tutorial, except for any naming differences due to the Kafka version.

When following the instructions for installing and running the Kafka broker on Windows it is important that you use a Linux terminal window and NOT the Windows PowerShell terminal.