Member-only story
Start Kafka service failed on Ubuntu
I followed along with tutorial from digital ocean but failed. I hope this could help.
The reason for run service failed due to zookeeper and kafka cannot find java. The temporary workaround this is to add environment variable to zookeeper.service and kafka.service files.
kafka.service
[Unit]
Requires=zookeeper.service
After=zookeeper.service[Service]
Type=simple
User=kafka
ExecStart=/bin/sh -c '/home/kafka/kafka/bin/kafka-server-start.sh /home/kafka/kafka/config/server.properties > /home/kafka/kafka/kafka.log 2>&1'
ExecStop=/home/kafka/kafka/bin/kafka-server-stop.sh
Restart=on-abnormalEnvironment=JAVA_HOME=/usr/lib/jvm/jdk1.8.0_281[Install]
WantedBy=multi-user.target
zookeeper.service
[Unit]
Requires=network.target remote-fs.target
After=network.target remote-fs.target[Service]
Type=simple
User=kafka
ExecStart=/home/kafka/kafka/bin/zookeeper-server-start.sh /home/kafka/kafka/config/zookeeper.properties
ExecStop=/home/kafka/kafka/bin/zookeeper-server-stop.sh
Restart=on-abnormalEnvironment=JAVA_HOME=/usr/lib/jvm/jdk1.8.0_281[Install]
WantedBy=multi-user.target