参考博文:https://www.mtyun.com/library/how-to-install-kafka-on-centos7

一、安装准备 1、修改系统配置 #关闭selinux、firewall #修改/etc/security/limits.conf添加以下内容:

  • soft nofile 65536
  • hard nofile 65536
  • soft nproc 65536
  • hard nproc 65536
    #修改/etc/security/limits.d/20-nproc.conf
  •      soft    nproc     65536
    

3、创建账户、目录 groupadd -g 800 kafka useradd -u 800 -g kafka kafka

二、安装步骤 1、解压文件 tar xvf kafka_2.12-1.0.0.tgz -C /usr/local/ cd /usr/local/ mv kafka_2.12-1.0.0/ kafka chown -R kafka.kafka /usr/local/kafka 2、修改环境变量.bash_profile #su - kafka #vim .bash_profile JAVA_HOME=/usr/local/jdk CLASSPATH=$JAVA_HOME/lib PATH=$JAVA_HOME/bin:$PATH:$HOME/bin:/usr/local/kafka/bin export PATH JAVA_HOME CLASSPATH #重新加载.bash_profile #. .bash_profile 3、启动kafka zookeeper-server-start.sh -daemon /usr/local/kafka/config/zookeeper.properties nohup kafka-server-start.sh /usr/local/kafka/config/server.properties >/dev/null 2>&1 &