Installing Kafka On Linux

In this article, i will show you how to install Apache Kafka on Linux.
Step 1 — Verifying Java Installation
Since Kafka supports java8 and above you should install java on your system.
Verify using command (java -version)
$ java -version
Step2 — Download Apache Kafka
Go to https://kafka.apache.org/downloads and download the Kafka binaries as Scala
Extract the file using command
$ tar –xvzf kafka_2.12-2.6.0.tgz
Step 3 — Test if Kafka well installed
Go to kafka directory and run command :
$ bin/kafka-topics.sh
Step 4 — Edit PATH to include KAFKA
To use Kafka command in any directory, edit file in ~/.bashrc file by adding PATH where you kafka directory is placed :
export PATH=/home/oubelque/kafka_2.12-2.6.0/bin:$PATH
Step 5 — Zookeeper & Kafka configuration
Edit zookeeper.properties :
dataDir=/home/oubelque/kafka_2.12-2.6.0/data/zookeeper
Edit server.properties :
log.dirs=/home/oubelque/kafka_2.12-2.6.0/data/kafka
Step 6 — Start Zookeeper
Start Zookeeper in one terminal using command :
$ zookeeper-server-start.sh config/zookeeper.properties
You should see this message : INFO binding to port 0.0.0.0/0.0.0.0:2181
Step 7 — Start Kafka
Start Kafka broker in another terminal using command :
$ kafka-server-start.sh config/server.properties
Latest articles
How to Stop Execution After a certain Time in Java
Implement the Runnable interface using lambda expression in Java?