How to Install Kafka on Clear Linux Latest
In this tutorial, we will guide you through the steps to install Kafka on Clear Linux Latest.
Prerequisites
Before proceeding with the installation, you will need the following:
- A running instance of Clear Linux Latest.
- An active internet connection.
- Administrative privileges to execute commands with sudo.
Step 1 - Install Java
Kafka requires Java to be installed on the system. The Clear Linux Latest comes with OpenJDK pre-installed but we recommend installing Oracle JDK for better performance.
To install Oracle JDK 11, follow the below commands.
sudo swupd bundle-add java-runtime
sudo swupd bundle-add java-basic
Check the Java version by running the java -version command. If installed correctly, you should see the following output:
java version "11.0.5" 2019-10-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.5+10-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.5+10-LTS, mixed mode)
Step 2 - Download Kafka
- Open the Kafka Download Page on your web browser.
- On the page, choose the latest stable version of Kafka and click on the download link for the binary program of your choice (for example,
kafka_2.13-2.6.2.tgz). - Navigate to the directory where you want to download and extract the Kafka archive, and execute the following command to download the Kafka package:
wget https://mirror.csclub.uwaterloo.ca/apache/kafka/2.6.2/kafka_2.13-2.6.2.tgz
- Extract the downloaded archive using the following command:
tar -xzf kafka_2.13-2.6.2.tgz
- Move the extracted Kafka directory to the desired location:
mv kafka_2.13-2.6.2 /opt/kafka
Step 3 - Start Kafka Cluster
- Change to the Kafka directory:
cd /opt/kafka
- Start the Kafka server and ZooKeeper by creating two separate processes with the following command:
./bin/zookeeper-server-start.sh config/zookeeper.properties &
./bin/kafka-server-start.sh config/server.properties &
Step 4 - Create Kafka Topics
- To create a Kafka topic, use the following command:
./bin/kafka-topics.sh --create --topic my-topic --bootstrap-server localhost:9092
- To check the list of available topics, execute the following command:
./bin/kafka-topics.sh --list --bootstrap-server localhost:9092
Conclusion
That’s it! You have successfully installed Apache Kafka on Clear Linux Latest. You can now use Kafka on your machine to build robust and scalable real-time streaming applications.