How to Install Apache Kafka on Ubuntu 24.04

Apache Kafka is a powerful distributed event streaming platform used for real-time data processing, messaging, and logging. In this guide, we’ll walk through the step-by-step process of installing and setting up Kafka on Ubuntu 24.04.

1….


This content originally appeared on DEV Community and was authored by Abhinav

Apache Kafka is a powerful distributed event streaming platform used for real-time data processing, messaging, and logging. In this guide, we’ll walk through the step-by-step process of installing and setting up Kafka on Ubuntu 24.04.

1. Prerequisites

Before installing Kafka, ensure you have:

✅ A system running Ubuntu 24.04

Java 17+ installed

✅ Root or sudo privileges

2. Install Java (OpenJDK 17)

Kafka requires Java to run. Install it with:

sudo apt update
sudo apt install openjdk-17-jdk -y

Verify Java installation:

java -version

Expected output (version may vary):

openjdk version "17.0.9" 2024-01-15

3. Download Apache Kafka

Visit the official Kafka download page and copy the latest binary version’s link. Then, download and extract it:

wget https://downloads.apache.org/kafka/3.6.0/kafka-3.9.0-src.tgz
tar -xvzf kafka-3.9.0-src.tgz 
sudo mv kafka-3.9.0-src.tgz  /opt/kafka

Navigate to Kafka’s directory:

cd /opt/kafka

4. Start Zookeeper

Kafka requires Zookeeper to manage broker nodes. Start Zookeeper with:

bash bin/zookeeper-server-start.sh config/zookeeper.properties

Leave this terminal open while running Kafka.

Image description

5. Start Kafka Broker

Open a new terminal and start the Kafka broker:

bin/kafka-server-start.sh config/server.properties

Image description

Leave this terminal open while using Kafka.

6. Create a Kafka Topic

Once Kafka is running, open a new terminal and create a test topic named test-topic:

/opt/kafka/bin/kafka-topics.sh --create --topic test-topic --bootstrap-server localhost:9092 --partitions 1 --replication-factor 1

Verify the topic list:

/opt/kafka/bin/kafka-topics.sh --list --bootstrap-server localhost:9092

7. Send and Consume Messages

Send a Message (Producer)

/opt/kafka/bin/kafka-console-producer.sh --topic test-topic --bootstrap-server localhost:9092

Type a message and press Enter.

Image description

Consume Messages (Consumer)

bin/kafka-console-consumer.sh --topic test-topic --from-beginning --bootstrap-server localhost:9092

You should see the message you typed earlier.

Image description

Conclusion

Congratulations! 🎉 You have successfully installed and configured Apache Kafka on Ubuntu 24.04. Now, you can start using Kafka for real-time data streaming, event-driven architectures, and more.

Would you like a guide on integrating Kafka with NestJS? Let me know! 🚀


This content originally appeared on DEV Community and was authored by Abhinav


Print Share Comment Cite Upload Translate Updates
APA

Abhinav | Sciencx (2025-02-05T17:29:03+00:00) How to Install Apache Kafka on Ubuntu 24.04. Retrieved from https://www.scien.cx/2025/02/05/how-to-install-apache-kafka-on-ubuntu-24-04/

MLA
" » How to Install Apache Kafka on Ubuntu 24.04." Abhinav | Sciencx - Wednesday February 5, 2025, https://www.scien.cx/2025/02/05/how-to-install-apache-kafka-on-ubuntu-24-04/
HARVARD
Abhinav | Sciencx Wednesday February 5, 2025 » How to Install Apache Kafka on Ubuntu 24.04., viewed ,<https://www.scien.cx/2025/02/05/how-to-install-apache-kafka-on-ubuntu-24-04/>
VANCOUVER
Abhinav | Sciencx - » How to Install Apache Kafka on Ubuntu 24.04. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/02/05/how-to-install-apache-kafka-on-ubuntu-24-04/
CHICAGO
" » How to Install Apache Kafka on Ubuntu 24.04." Abhinav | Sciencx - Accessed . https://www.scien.cx/2025/02/05/how-to-install-apache-kafka-on-ubuntu-24-04/
IEEE
" » How to Install Apache Kafka on Ubuntu 24.04." Abhinav | Sciencx [Online]. Available: https://www.scien.cx/2025/02/05/how-to-install-apache-kafka-on-ubuntu-24-04/. [Accessed: ]
rf:citation
» How to Install Apache Kafka on Ubuntu 24.04 | Abhinav | Sciencx | https://www.scien.cx/2025/02/05/how-to-install-apache-kafka-on-ubuntu-24-04/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.