# Kafka安装(0.10.2.2)
##### [官网](https://kafka.apache.org/downloads)下载安装包
> `kafka_2.12-0.10.2.2.tgz` [点击下载](https://archive.apache.org/dist/kafka/0.10.2.2/kafka_2.12-0.10.2.2.tgz)
##### 解压安装包
```shell
tar -zxvf kafka_2.12-0.10.2.2.tgz -C /usr/local/
```
##### 创建`data`目录
```shell
mkdir /usr/local/kafka_2.12-0.10.2.2/data
```
##### 修改配置
1. 配置端口
```shell
sed -i '/#listeners=PLAINTEXT/clisteners=PLAINTEXT:\/\/:9092' \
/usr/local/kafka_2.12-0.10.2.2/config/server.properties
```
2. 修改`log.dirs`参数
```shell
sed -i '/log.dirs/clog.dirs=\/usr\/local\/kafka_2.12-0.10.2.2\/data' \
/usr/local/kafka_2.12-0.10.2.2/config/server.properties
```
> broker.id :集群唯一id , zookeeper.connect :zookeeper连接地址
##### 启动Kafka
> 先确保zookeeper已经启动
```shell
/usr/local/kafka_2.12-0.10.2.2/bin/kafka-server-start.sh \
/usr/local/kafka_2.12-0.10.2.2/config/server.properties
```
开启端口
```shell
firewall-cmd --zone=public --add-port=9092/tcp --permanent;
firewall-cmd --reload;
firewall-cmd --list-port;
```