Refer : https://www.digitalocean.com/community/tutorials/how-to-install-apache-kafka-on-ubuntu-20-04
Step 1: Create Kafka User and Download Binaries
Create a new user
sudo useradd -m -s /bin/bash kafka
Grant sudo privileges
sudo visudo
Add this line at the bottom:
kafka ALL=(ALL) ALL
Switch to the kafka user
su -l kafka
Create a Downloads directory and move into it
mkdir -p ~/Downloads
cd ~/Downloads
Download Kafka binaries
wget https://downloads.apache.org/kafka/3.6.0/kafka_2.13-3.6.0.tgz -O kafka.tgz
Create Kafka directory and extract binaries
mkdir ~/kafka
tar -xvzf kafka.tgz -C ~/kafka --strip-components=1
Step 2: Configure Kafka
Open Kafka server configuration
nano ~/kafka/config/server.properties
Enable topic deletion
Set this property inside the file:
delete.topic.enable=true
Step 3: Create Systemd Services for Kafka:
systemctl
gives better control with start
, stop
, and enable
optionsStep 4: Run a zookeeper along with kafka