There are three ways to install a Kafka environment:
- Downloading the executable files
- Using brew (in macOS) or yum (in Linux)
- Installing Confluent Platform
For all three ways, the first step is to install Java; we need Java 8. Download and install the latest JDK 8 from the Oracle's website:
http://www.oracle.com/technetwork/java/javase/downloads/index.html
At the time of writing, the latest Java 8 JDK version is 8u191.
For Linux users :
- Change the file mode to executable as follows, follows these steps:
> chmod +x jdk-8u191-linux-x64.rpm
- Go to the directory in which you want to install Java:
> cd <directory path>
- Run the rpm installer with the following command:
> rpm -ivh jdk-8u191-linux-x64.rpm
- Add to your environment the JAVA_HOME variable. The following command writes the JAVA_HOME environment variable to the /etc/profile file:
> echo "export JAVA_HOME=/usr/java/jdk1.8.0_191" >> /etc/profile
- Validate the Java installation as follows:
> java -version
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
At the time of writing, the latest Scala version is 2.12.6. To install Scala in Linux, perform the following steps:
- Download the latest Scala binary from http://www.scala-lang.org/download
- Extract the downloaded file, scala-2.12.6.tgz, as follows:
> tar xzf scala-2.12.6.tgz
- Add the SCALA_HOME variable to your environment as follows:
> export SCALA_HOME=/opt/scala
- Add the Scala bin directory to your PATH environment variable as follows:
> export PATH=$PATH:$SCALA_HOME/bin
- To validate the Scala installation, do the following:
> scala -version
Scala code runner version 2.12.6 -- Copyright 2002-2018,
LAMP/EPFL and Lightbend, Inc.
To install Kafka on your machine, ensure that you have at least 4 GB of RAM, and the installation directory will be /usr/local/kafka/ for macOS users and /opt/kafka/ for Linux users. Create these directories according to your operating system.