<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Kafka Archives - LinuxTuto</title>
	<atom:link href="https://www.linuxtuto.com/tag/kafka/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.linuxtuto.com/tag/kafka/</link>
	<description>Linux Sysadmin and DevOps blog</description>
	<lastBuildDate>Thu, 10 Apr 2025 18:57:56 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>

<image>
	<url>https://www.linuxtuto.com/wp-content/uploads/2022/01/cropped-LT_faveicon-32x32.png</url>
	<title>Kafka Archives - LinuxTuto</title>
	<link>https://www.linuxtuto.com/tag/kafka/</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">201456972</site>	<item>
		<title>How to Install Apache Kafka on Ubuntu 24.04</title>
		<link>https://www.linuxtuto.com/how-to-install-apache-kafka-on-ubuntu-24-04/</link>
					<comments>https://www.linuxtuto.com/how-to-install-apache-kafka-on-ubuntu-24-04/#respond</comments>
		
		<dc:creator><![CDATA[LinuxTuto]]></dc:creator>
		<pubDate>Thu, 10 Apr 2025 18:31:52 +0000</pubDate>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Kafka]]></category>
		<guid isPermaLink="false">https://www.linuxtuto.com/?p=1899</guid>

					<description><![CDATA[<p>Apache Kafka is an open-source distributed event streaming platform used for building real-time data pipelines and applications. Originally developed by LinkedIn and now part of...</p>
<p>The post <a href="https://www.linuxtuto.com/how-to-install-apache-kafka-on-ubuntu-24-04/">How to Install Apache Kafka on Ubuntu 24.04</a> appeared first on <a href="https://www.linuxtuto.com">LinuxTuto</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong data-start="0" data-end="16">Apache Kafka</strong> is an open-source distributed event streaming platform used for building real-time data pipelines and applications. Originally developed by LinkedIn and now part of the Apache Software Foundation, Kafka is designed for high-throughput, low-latency, and fault-tolerant data processing across systems.</p>
<p>In this tutorial, we will show you the complete steps to install Apache Kafka on Ubuntu 24.04 OS.</p>
<h2><span class="has-inline-color has-vivid-purple-color">Step 1: Update Operating System</span></h2>
<p>Update your <strong>Debian 12</strong> operating system to make sure all existing packages are up to date:</p>
<pre><code># apt update &amp;&amp; apt upgrade</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Step 2: Install Java (OpenJDK) on Ubuntu 24.04</span></h2>
<p>Java packages are available on Ubuntu 24.04 repositories and you can install it with the following command:</p>
<pre><code># apt install default-jdk</code></pre>
<p>Check Java version after installation:</p>
<pre><code># java -version
openjdk version "21.0.6" 2025-01-21
OpenJDK Runtime Environment (build 21.0.6+7-Ubuntu-124.04.1)
OpenJDK 64-Bit Server VM (build 21.0.6+7-Ubuntu-124.04.1, mixed mode, sharing)</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Step 3: Download Apache Kafka</span></h2>
<p>Check the official <a href="https://downloads.apache.org/kafka/">Apache Kafka Download page</a> to locate the latest version of the software.</p>
<p>The latest version at the moment is 4.0.0. You can download it with the following command:</p>
<pre><code># wget https://downloads.apache.org/kafka/4.0.0/kafka_2.13-4.0.0.tgz</code></pre>
<p>Once that downloads, unpack the tarball file using the following command:</p>
<pre><code># tar xvf kafka_2.13-4.0.0.tgz</code></pre>
<p>Then move this directory into the <strong>/usr/local/</strong> directory and rename it kafka:</p>
<pre><code># mv kafka_2.13-4.0.0 /usr/local/kafka</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Step 4: Create a systemd file for Apache Kafka</span></h2>
<p>First navigate to Kafka’s directory:</p>
<div class="highlight js-code-highlight">
<pre class="highlight shell"><code><span class="nb"># cd</span> /usr/local/kafka</code></pre>
</div>
<p>Then you need to generate a Cluster UUID:</p>
<pre class="language-bash" tabindex="0"><code class="language-bash"># <span class="token assign-left variable">KAFKA_CLUSTER_ID</span><span class="token operator">=</span><span class="token string">"<span class="token variable">$(bin/kafka-storage.sh random-uuid)</span>"</span></code></pre>
<p>Format Log Directories:</p>
<pre class="language-bash" tabindex="0"><code class="language-bash"># bin/kafka-storage.sh <span class="token function">format</span> --standalone -t <span class="token variable">$KAFKA_CLUSTER_ID</span> -c config/server.properties</code></pre>
<p>Now create a <strong>systemd</strong> file so you can control the Kafka service. Create the file with the following command:</p>
<pre><code># nano /etc/systemd/system/kafka.service</code></pre>
<p>In that file, paste the following content:</p>
<pre><code>[Unit]
Description=Apache Kafka Server
Documentation=http://kafka.apache.org/documentation.html
Requires=zookeeper.service

[Service]
Type=simple
Environment="JAVA_HOME=/usr/lib/jvm/java-1.21.0-openjdk-amd64"
ExecStart=/usr/local/kafka/bin/kafka-server-start.sh /usr/local/kafka/config/server.properties
ExecStop=/usr/local/kafka/bin/kafka-server-stop.sh

[Install]
WantedBy=multi-user.target
</code></pre>
<p>Save the changes and exit.</p>
<p>Reload system daemon and start the services:</p>
<pre><code># systemctl daemon-reload
# systemctl start kafka
# systemctl enable kafka</code></pre>
<p>To confirm everything is working normally, check the status of service:</p>
<pre><code># systemctl status kafka</code></pre>
<p>Output:</p>
<pre><code>● kafka.service - Apache Kafka Server
     Loaded: loaded (/etc/systemd/system/kafka.service; enabled; preset: enabled)
     Active: active (running)
       Docs: http://kafka.apache.org/documentation.html
   Main PID: 11915 (java)
      Tasks: 99 (limit: 2217)
     Memory: 365.1M (peak: 365.4M)
        CPU: 16.435s
     CGroup: /system.slice/kafka.service</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">S</span><span class="has-inline-color has-vivid-purple-color">tep 5: Create a Kafka Topic</span></h2>
<p>So before you can write your first events, you must create a topic. Create a topic named “<code class="language-bash">my-events</code>” with the following command:</p>
<pre><code># usr/local/kafka
# bin/kafka-topics.sh --create --topic my-events --bootstrap-server localhost:9092

Created topic my-events.
</code></pre>
<p>To verify the topic list run the following command:</p>
<pre><code># bin/kafka-topics.sh --list --bootstrap-server localhost:9092
my-events</code></pre>
<p>The Kafka comes with a command-line client that will take input from a file or from standard input and send it out as events to the <code>Kafka</code> cluster.</p>
<p>By default, each line you enter will result in a separate event being written to the topic.</p>
<pre><code># bin/kafka-console-producer.sh --topic my-events --bootstrap-server localhost:9092

&gt;Hello World!
&gt;This is my first topic</code></pre>
<p>You can stop the consumer client with <code>Ctrl-C</code> at any time.</p>
<p>If you also want to delete any data of your local Kafka environment including any events you have created along the way, run the command:</p>
<pre class="language-bash" tabindex="0"><code class="language-bash"># <span class="token function">rm</span> -rf /tmp/kafka-logs /tmp/kraft-combined-logs</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Comments and Conclusion</span></h2>
<p>That&#8217;s it! You have now installed and started <code>Apache Kafka</code> on your Ubuntu 24.04 system.</p>
<p>Remember that this guide assumes you have administrative privileges on your system.</p>
<p>Always check the <a href="https://kafka.apache.org/documentation/">official Apache Kafka documentation</a> for the most up-to-date installation instructions and any specific considerations related to your system configuration.</p>
<p>If you have any questions please leave a comment below.</p>
<p>The post <a href="https://www.linuxtuto.com/how-to-install-apache-kafka-on-ubuntu-24-04/">How to Install Apache Kafka on Ubuntu 24.04</a> appeared first on <a href="https://www.linuxtuto.com">LinuxTuto</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.linuxtuto.com/how-to-install-apache-kafka-on-ubuntu-24-04/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1899</post-id>	</item>
	</channel>
</rss>
