Pre-Installation Setup
Basic environment preparation must be performed on all nodes of the Kafka cluster. These steps ensure the correct installation and operation of Kafka services.
- Creating a System Group and User
Kafka will run under a dedicated system user. To create it, execute the following commands:
$ sudo groupadd -g 995 kafka
$ sudo useradd -u 995 -g 995 kafka
- Creating the Base Installation Directory
$ sudo mkdir /app
- Copying the Installation Archive
Copy the kafka.tar.gz archive containing the Kafka distribution to the /tmp directory.
- Extracting the
KafkaArchive
Extract the archive contents directly into the /app directory:
$ sudo tar zxvf /tmp/kafka.tar.gz -C /app/ --strip 1
Note
The --strip 1 option is used to extract the archive contents without nested directories.
- Verifying the Contents of the
/appDirectory
After extraction, ensure the required directories have been created:
$ ls -al /app
Directory Structure After Extracting Kafka:
| Directory | Purpose |
|---|---|
certs | Storage for SSL certificates to secure communication between Kafka components. |
jdk | Java Runtime Environment (JDK) required for Kafka operation. |
kafka | The working directory for Kafka. |
logs | Directory for storing Kafka logs. |
service | Service files for managing and launching the Kafka service. |
- Setting Permissions
Change the ownership of all created directories to the Kafka user:
$ sudo chown -R kafka:kafka /app/{certs,jdk,kafka,logs,service}