1.安装java
yum -y install java-1.8.0-openjdk
完毕之后查看是否成功
java -version
配置java环境
echo "JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")" | sudo tee -a /etc/profile
让配置生效
source /etc/profile
2.安装kafka
从官网下载
https://mirror.bit.edu.cn/apache/kafka/2.6.0/kafka_2.13-2.6.0.tgz
解压
tar -zvxf kafka_2.13-2.6.0.tgz -C /opt/
mv kafka_2.13-2.6.0 kafka
mv kafka /usr/local/
注意不要下载带src带文件
创建zookeeper.service系统服务单元
vi /etc/systemd/system/zookeeper.service
[Unit]
Description=Apache Zookeeper server
Documentation=http://zookeeper.apache.org
Requires=network.target remote-fs.target
After=network.target remote-fs.target
[Service]
Type=simple
ExecStart=/usr/local/kafka/bin/zookeeper-server-star