If you’ve been itching to learn how to install this powerful, open-source distributed streaming platform on your Windows machine, you’ve come to the right place!
This easy-to-follow, step-by-step tutorial will guide you through setting up the Apache Kafka on your Windows PC in no time. With our friendly tone and detailed explanations, you’ll feel like you’re learning from a trusted friend who has your back every step of the way.
As you embark on this exhilarating journey, you’ll soon discover the many benefits of using Apache Kafka for real-time data streaming and processing. From improving the scalability of your applications to enhancing the fault tolerance and data durability, there’s a whole new world of possibilities just waiting for you to explore.
So, whether you’re a seasoned developer or a curious newcomer, let’s start this incredible adventure and master the art of installing Apache Kafka on Windows together!
Requirements:
For this tutorial, we will show you how to install Apache Kafka on Windows using the Windows Subsystem for Linux feature.
For compatibility, you are required to have the Windows 10 Build 1903 and higher.
Note: Although it is possible to run Kafka on JVM on native Windows, it lacks some features which are tied to POSIX. For example, you may encounter some Apache Kafka server crashes after modifying topics.
Setting Up WSL on Windows
Once you make sure that you have the required Windows build version, we can proceed and enable the WSL on your machine.
Click on the start menu and search for “turn windows features on or off”. Select the matching option.
In the Windows Features window, select the following features and make sure that they are enabled:
- Windows Subsystem for Linux
- Virtual Machine Platform
Click on “Ok” to apply the changes to your system. This may require you to restart your system.
Once restarted, we must enable the WSL version 2 to ensure that we have the latest kernel version. We can do this by installing the WSL version 2 kernel update installer that is provided in the following link: https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
Once configured, we can proceed to the next step.
Installing a Linux Distro on WSL
Once WSL is enabled, we must install a Linux distribution that we will use. For this, we recommend using Ubuntu since it is highly optimized to work with WSL on a wide range of scenarios.
Open the PowerShell prompt as administrator and run the following command:
The previous command downloads and installs Ubuntu on WSL with a simple command.
Once completed, you can launch it from the start menu or run the following command:
This launches the Ubuntu distro on the machine. Next, wait for the install process to complete and setup your accounts.
Installing the Java JDK
Run the following command in the Ubuntu terminal to refresh the system repositories:
Install the Java-common package with the following command:
Finally, run the following command to install the OpenJDK 11 on the system:
Once completed, check if the JDK has been configured correctly by verifying its version:
Installing Apache Kafka
Open your browser and download the latest version of Apache Kafka as provided in the following link: https://kafka.apache.org/downloads
Once downloaded, extract the archive to your target directory.
Rename the extracted directory to Kafka:
Finally, move the kafka directory to /opt:
Start the Zookeeper Service
Apache Kafka uses Zookeeper for cluster management. Hence, we need to make sure that the Zookeeper service is running before running Kafka.
We can do this by running the following command:
Make sure that you are in the Kafka directory before running the previous command.
Start the Apache Kafka Server
Open another Ubuntu shell window and run the following commands to start the Kafka server:
and
This should start the Kafka server using the default server configuration.
Conclusion
We discussed about how to configure the Apache Kafka on Windows using the Windows subsystem for Linux. You can also check other installation methods such as running Apache Kafka on Windows using Docker.