The open-source distributed event streaming technology Apache Kafka is used by businesses to build data pipelines and real-time streaming applications. It is designed to handle data streams with high volume, high throughput, and low latency with effectiveness. The popular Linux distribution Almalinux 8 is used for enterprise-level applications due to its dependability, stability, and security. It is a necessary step in developing a dependable and expandable real-time streaming platform, Although configuring Apache Kafka on Almalinux 8 can be difficult,
Our Server Management team will outline Apache Kafka installation instructions for Almalinux 8 in this article.
Prerequisites:
Before installing Apache Kafka on Almalinux 8, there are a few conditions that must be met. These prerequisites ensure a seamless installation and flawless operation of the application. Apache Kafka installation on Almalinux 8 requires the fulfillment of the following prerequisites:
- Java: Java 8 or a more recent version is required for Apache Kafka to work. You must make sure that Java is installed on your Almalinux 8 system in light of this. You can check if Java is set up on your system by typing the following command in the terminal:
java -version
If Java isn’t already installed on your computer, run the following command in the terminal to do so:
sudo dnf install java-1.8.0-openjdk-devel
- Using ZooKeeper: Apache Kafka controls and synchronizes its distributed nodes. Therefore, you must make sure that ZooKeeper is installed on your Almalinux 8 computer. Run the following command in the terminal to check if ZooKeeper is installed on your system:
systemctl status zookeeper
If ZooKeeper isn’t already installed on your computer, run the following command in the terminal to do so:
sudo dnf install zookeeper-server
- User Account: The root user should not be used to launch Apache Kafka. You must create a user account for Kafka as a result. To make a Kafka user account, enter the following command in the terminal:
sudo useradd kafka -m
This will grant Kafka a fresh user account with a home directory.
These conditions must be met in order to ensure a trouble-free installation of Apache Kafka on Almalinux 8.
Installation Instructions:
Update the system:
- Running the following command will update the system first:
sudo dnf update
Install Java:
- Apache Kafka must be run in a Java runtime environment. We must therefore install the Java Development Kit (JDK) on the computer. To install JDK 8, enter the following command:
sudo dnf install java-1.8.0-openjdk-devel
Download Kafka:
- On the official Apache Kafka website, the Kafka binaries must then be downloaded. We can obtain the most recent edition of Kafka by executing the following command:
sudo dnf install java-1.8.0-openjdk-deve
Extract Kafka:
- After the download is complete, the Kafka archive needs to be extracted. To execute this step , enter the command shown below:
tar -xzf kafka_2.13-3.0.0.tgz
By doing this, the directory kafka 2.13-3.0.0 will be created and used to extract the Kafka archive.
Move Kafka:
- Following that, the extracted Kafka directory needs to be moved to the /usr/local/kafka directory. By using the upcoming command, you can run this:
sudo mv kafka_2.13-3.0.0 /usr/local/kafka
Environmental variable set:
- To run Kafka commands from any directory, the PATH environment variable must contain the Kafka bin directory. The following line can be added at the end of the file by gaining access to the /.bashrc directory:
export PATH=$PATH:/usr/local/kafka/bin
File exit and saving
- Updating the bashrc file
Reloading the Bashrc file is necessary to apply the changes we made. To execute this, type the following command:
source ~/.bashrc
Launch ZooKeeper:
- Apache Kafka uses ZooKeeper to keep track of and synchronize brokers. Therefore, we must start the ZooKeeper server first, followed by the Kafka server. To start the ZooKeeper server, execute the following command:
zookeeper-server-start.sh config/zookeeper.properties
Note: You should execute this command from the Kafka directory (/usr/local/kafka).
Begin Kafka:
- To start the Kafka server, type the following command into a new terminal window.
kafka-server-start.sh config/server.properties
You should also run this command from the Kafka directory (/usr/local/kafka), keep in mind.
Conclusion:
Apache Kafka offers a powerful distributed streaming platform for real-time data pipelines, streaming analytics, and event-driven systems. In this article, we went into great detail on how to install Apache Kafka on AlmaLinux 8. Every step that was necessary, including updates, was discussed.
Our Server Support team will help you with any additional questions you may have.