<!DOCTYPE html><html><head><title>Kafka 入门教程之一: 安装</title><meta charset='utf-8'><link href='https://cdn.maxiang.io/res-min/themes/marxico.css' rel='stylesheet'><style>
.note-content {font-family: 'Helvetica Neue', Arial, 'Hiragino Sans GB', STHeiti, 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, Song, sans-serif;}
</style></head><body><div id='preview-contents' class='note-content'>
<h2 id="kafka-入门教程之一-安装">Kafka 入门教程之一: 安装</h2>
<h4 id="1-官网下载软件">1. 官网下载软件</h4>
<p><a href="http://kafka.apache.org/" target="_blank">http://kafka.apache.org/</a> </p>
<p><img longdesc="./1543296020347.png" alt="Alt text" title="" type="image/png" src="https://img-blog.csdnimg.cn/2022010705415375303.png" class=""></p>
<h4 id="2-安装单节点kafka">2. 安装单节点kafka</h4>
<h5 id="a-创建用户kafka">a) 创建用户kafka</h5>
<pre class="prettyprint hljs-dark"><code class="language-powershell hljs"><div class="hljs-line">[root@tjtestrac1 ~]<span class="hljs-comment"># useradd kafka </span>
</div><div class="hljs-line">[root@tjtestrac1 ~]<span class="hljs-comment"># passwd kafka</span>
</div><div class="hljs-line">Changing password <span class="hljs-keyword">for</span> user kafka.
</div><div class="hljs-line">New password:
</div><div class="hljs-line">BAD PASSWORD: The password is shorter than <span class="hljs-number">8</span> characters
</div><div class="hljs-line">Retype new password:
</div><div class="hljs-line">passwd: all authentication tokens updated successfully.
</div></code></pre>
<h4 id="b-解压软件包">b) 解压软件包</h4>
<pre class="prettyprint hljs-dark"><code class="language-powershell hljs"><div class="hljs-line">[kafka@tjtestrac1 ~]$ ls
</div><div class="hljs-line">kafka_2.<span class="hljs-number">12</span>-<span class="hljs-number">2.1</span>.<span class="hljs-number">0</span>.tgz
</div><div class="hljs-line">[kafka@tjtestrac1 ~]$ tar -xvf kafka_2.<span class="hljs-number">12</span>-<span class="hljs-number">2.1</span>.<span class="hljs-number">0</span>.tgz
</div></code></pre>
<h4 id="c-配置环境变量-kafkahome-和-javahome">c) 配置环境变量 kafka_home 和 java_home</h4>
<pre class="prettyprint hljs-dark"><code class="language-powershell hljs"><div class="hljs-line">[kafka@tjtestrac1 ~]$ vi .bash_profile
</div><div class="hljs-line">export KAFKA_HOME=/home/kafka/kafka_2.<span class="hljs-number">12</span>-<span class="hljs-number">2.1</span>.<span class="hljs-number">0</span>
</div><div class="hljs-line">export JAVA_HOME=/u02/cassandra/java/jdk1.<span class="hljs-number">8.0</span>_162
</div><div class="hljs-line">PATH=<span class="hljs-variable">$PATH:</span><span class="hljs-variable">$HOME</span>/.local/bin:<s
Kafka 入门教程之一: 安装
最新推荐文章于 2023-07-10 19:12:40 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)