一、安装java8
下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
1、安装
[root@localhost]# cd /usr/local
[root@localhost]# mkdir java8
[root@localhost java8]# cd java8
[root@localhost java8]# cp /vagrant/jdk-8u151-linux-x64.tar.gz .
[root@localhost java8]# tar -zxvf jdk-8u151-linux-x64.tar.gz
2、配置
[root@localhost java8]# ln -s /usr/local/java8/jdk1.8.0_151/ /usr/jdk
[root@localhost java8]# vi /etc/profile
添加如下代码:
JAVA_HOME=/usr/jdk
CLASSPATH=$JAVA_HOME/lib/
PATH=$PATH:$JAVA_HOME/bin
export PATH JAVA_HOME CLASSPATH
[root@localhost java8]# source /etc/profile
[root@localhost java8]# java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
二、安装kafka
1、配置防火墙
[root@localhost java8]# vi /etc/sysconfig/iptables
新增:
-A INPUT -p tcp -m state --state NEW -m tcp --dport 9092 -j ACCEPT
[root@localhost java8]# service iptables restart
2、安装kafka
[root@localhost local]# wget http://archive.apache.org/dist/kafka/0.11.0.0/kafka_2.11-0.11.0.0.tgz
[root@localhost local]# tar -zxvf kafka_2.11-0.11.0.0.tgz
[root@localhost local]# mv kafka_2.11-0.11.0.0 kafka
3、启动zookeeper
[root@localhost local]# nohup /usr/local/kafka/bin/zookeeper-server-start.sh /usr/local/kafka/config/zookeeper.properties &
4、启动kafka
[root@localhost local]# nohup /usr/local/kafka/bin/kafka-server-start.sh /usr/local/kafka/config/server.properties &