Prerequisites

To follow this tutorial, you will need:

  • Ubuntu 20.04 server set up,  including a sudo non-root user and a firewall.


Installing the Default JRE/JDK

The easiest option for installing Java is to use the version packaged with Ubuntu. By default, Ubuntu 20.04 includes Open JDK 11,  which is an open-source variant of the JRE and JDK.

To install this version, first update the package index:

  • sudo apt update
 

Next, check if Java is already installed:

  • java -version
 

If Java is not currently installed, you’ll see the following output:

Output
Command 'java' not found, but can be installed with:

sudo apt install default-jre # version 2:1.11-72, or
sudo apt install openjdk-11-jre-headless # version 11.0.7+10-3ubuntu1
sudo apt install openjdk-13-jre-headless # version 13.0.3+3-1ubuntu2
sudo apt install openjdk-14-jre-headless # version 14.0.1+7-1ubuntu1
sudo apt install openjdk-8-jre-headless # version 8u252-b09-1ubuntu1

Execute the following command to install the default Java Runtime Environment (JRE), which will install the JRE from OpenJDK 11:

  • sudo apt install default-jre
 


Verify the installation with:

  • java -version
 

You should see the following output:

Output
openjdk version "11.0.7" 2020-04-14
OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-3ubuntu1)
OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-3ubuntu1, mixed mode, sharing)

You may need the Java Development Kit (JDK) in conjuction  to the JRE in order to compile and run some specific Java-based software. To install the JDK, run the following command, which will also install the JRE:

  • sudo apt install default-jdk
 

Verify that the JDK is installed by checking the version of javac, the Java compiler:

  • javac -version
 

You should see the following output:

Output
javac 11.0.7


Download Flink

Download the Flink binary from https://flink.apache.org/downloads.html, and select the appropriate Scala variant.

Note: use some specific features you may also have to download one of the pre-bundled Hadoop jars and place them into the /lib directory.



Use wget command to dowload the Flink source file:

  • wget https://downloads.apache.org/flink/flink-1.12.0/flink-1.12.0-bin-scala_2.12.tgz


After downloading was completed done, than we will extract the file inside current directory using:

  •  tar -zxvf flink-1.12.0-bin-scala_2.12.tgz


Start a Local Flink Cluster

Change directory to the flink-1.12.0 directory, then run the executable file to start  the local Flink Cluster:

  • ./bin/start-cluster.sh
$ ./bin/start-cluster.sh
 Starting cluster.
 Starting standalonesession daemon on host 
 Starting taskexecutor daemon on host 


The Apache Flink web front-end can be accessed at http://{IP OF NODE}:8081: