# Kafka Installation on Linux

Published 2022-12-03

This tutorial explains to you how to install Apache Kafka on Linux. This tutorial explains step-by-step how to install Kafka on a Linux machine. There is an example as well.

If you are not understanding the Kafka Server architecture you can take a look at Apache Kafka Architecture before.

In order to have Kafka server up and running you must download the software from https://kafka.apache.org/downloads.

From this location click on the most recent version of Apache Kafka (Kafka 2.13 in my case) and you will see something like this:

Click on the file to be downloaded. Generally this is done on a Windows machine.

In order to install Apache Kafka on a Linux Machine (CentOS 8 in my case) you have to take a look at the following prerequisites:

Prerequisite #1: Have Java 8+ installed

# yum install java-11-openjdk-devel

Prerequisite #2: (optional) create a user for Kafka server administration

# useradd kafka
# passwd 1

Prerequisite #2: (optional) create a directory for the Apache Kafka server

# mkdir /kafka
# chown -R kafka:kafka /kafka

Now, copy kafka_2.13-2.8.0.tgz file to /kafka directory and extract the files from archive:

tar -xvf kafka_2.13-2.8.0.tgz

In the bin directory from Kafka Home directory you will have something like this:

Now you can put Kafka bin directory into the PATH by adding the following in the /home/kafka/.bashrc:

export PATH=/kafka/kafka_2.13-2.8.0/bin:$PATH

Now your Apache Kafka is installed and ready to be used. Now you can read how to start & stop Apache Kafka Server and also how to install Apache Kafka on cluster.