How to Install Kafka on Manjaro
Apache Kafka is an open-source distributed event streaming platform used by many companies for messaging, data streaming, and analytics. In this tutorial, you will learn how to install Apache Kafka on Manjaro, an Arch Linux-based operating system.
Prerequisites
Before installing Kafka on Manjaro, you will need to ensure that the following prerequisites are met:
- Manjaro Linux is installed on your computer and running properly.
- Java 8 or higher is installed on your system. If Java is not installed, you can install it using the command
sudo pacman -Syu jdk-openjdk.
Step 1: Download Kafka
First, open a new terminal window by pressing ctrl+alt+t on your keyboard. Then, download the version of Kafka you'd like to install from the Kafka website using the following command:
wget https://mirror.olnevhost.net/pub/apache/kafka/2.8.0/kafka_2.13-2.8.0.tgz
This command will download Kafka version 2.8.0, but you can replace the version number in the URL with the version you'd like to install.
Step 2: Extract Kafka
After downloading Kafka, navigate to the directory where the downloaded file is located by using the cd command. Then, extract the contents of the downloaded file using the following command:
tar xzf kafka_2.13-2.8.0.tgz
This command will create a new directory named kafka_2.13-2.8.0 in your current directory containing the Kafka files.
Step 3: Start Kafka
Once you've extracted Kafka, navigate to the bin directory inside the Kafka directory using the cd command. Then, start Zookeeper by running the following command:
./zookeeper-server-start.sh ../config/zookeeper.properties
After starting Zookeeper, open a new terminal window and navigate to the bin directory inside the Kafka directory again. Then, start the Kafka server using the following command:
./kafka-server-start.sh ../config/server.properties
Step 4: Test Kafka
To test that Kafka is running properly, open a new terminal window and navigate to the bin directory inside the Kafka directory. Then, create a new topic using the following command:
./kafka-topics.sh --create --topic test --bootstrap-server localhost:9092
After creating the topic, produce a message to the topic using the following command:
./kafka-console-producer.sh --topic test --bootstrap-server localhost:9092
Then, open a new terminal window and consume the message from the topic using the following command:
./kafka-console-consumer.sh --topic test --bootstrap-server localhost:9092 --from-beginning
If you receive the message you produced, Kafka is working properly.
Conclusion
In this tutorial, you learned how to install Apache Kafka on Manjaro Linux. By following these steps, you can start experimenting with Kafka and implement it in your own projects.