October 21, 2021
How to install Apache Nifi on Ubuntu 20.04

How to install Apache NiFi on Ubuntu 20.04 LTS

On this article we are going to discuss how to install Apache NiFi version 1.3.32 on Ubuntu 20.04 LTS operating system.

Introduction

Apache NiFi is an open source Apache Project which was built to automate the flow of data between systems. Apache NiFi is a Java based project so it executes within a JVM on a host operating system. It provides a web based interface to create, monitor and control data flow between Systems. Apache NiFi previously developed by the US National Security Agency (NSA), based on the “NiagaraFiles” software, then It was open-sourced as a part of NSA’s technology transfer program in 2014. On this article we will discuss how to install Apache Nifi on Ubuntu 20.04 LTS operating system.



Apache NiFi Architecture

Apache NiFi will be consist of several components as shown below.

Apache NiFi Architecture
Apache NiFi Architecture | source:https://en.wikipedia.org/wiki/Apache_NiFi
  • Web Server – the HTTP-based component used to visually control the software and monitor the events happening within
  • Flow Controller – serves as the brains of NiFi’s behaviour. Controls the running of Nifi extensions and schedules allocation of resources for this to happen.
  • Extensions – various plugins that allow Nifi to interact with various kinds of systems
  • FlowFile repository – used by NiFi to maintain and track status of the currently active FlowFile Or the information that NiFi is helping move between systems.
  • Content repository – the data in transit is maintained here
  • Provenance repository – data relating to the provenance of the data flowing through the system is maintained here.

Apache Nifi Installation on Ubuntu 20.04 LTS

On this tutorial, we will use last stable release of Apache Nifi, version 1.13.2 which was released on 19 March 2021. There are several requirements that must be met so that we can install Apache Nifi on Ubuntu 20.04, which will be explained below.

Prerequisite

  • Ubuntu 20.04 Server
  • A user with sudo or root privileges
  • OpenJDK 11 installed in your Server
  • Having apt or apt-get, wget and tar utility installed in your Server

Apache NiFi Installation Steps

1. Verify Java Installed on the system

After updating system server to synchronize our installed packages with the latest version, the we will check our installed Java version on our system. This task can be done by submittiong command line : java --version.

ramans@otodiginet:~$ java --version
 openjdk 11.0.11 2021-04-20
 OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04)
 OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)
OpenJDK 11.0.11 installed on the system
OpenJDK 11.0.11 installed on the system

2. Download Apache NiFi source and Extract it

On this step, we will download NiFi binary source from Apache NiFi official website by using wget command line. For this purpose, just hit the command line : wget https://downloads.apache.org/nifi/1.13.2/nifi-1.13.2-bin.tar.gz. I will download the files to my own home directory (/home/ramans/). The file size is about 1.47 GB.

ramans@otodiginet:~$ wget https://downloads.apache.org/nifi/1.13.2/nifi-1.13.2-bin.tar.gz
 --2021-07-13 23:33:38--  https://downloads.apache.org/nifi/1.13.2/nifi-1.13.2-bin.tar.gz
 Resolving downloads.apache.org (downloads.apache.org)… 135.181.214.104, 135.181.209.10, 88.99.95.219, …
 Connecting to downloads.apache.org (downloads.apache.org)|135.181.214.104|:443… connected.
 HTTP request sent, awaiting response… 200 OK
 Length: 1576430190 (1.5G) [application/x-gzip]
 Saving to: ‘nifi-1.13.2-bin.tar.gz’
 nifi-1.13.2-bin.tar.gz         100%[==================================================>]   1.47G   792KB/s    in 33m 18s 
 2021-07-14 00:06:57 (771 KB/s) - ‘nifi-1.13.2-bin.tar.gz’ saved [1576430190/1576430190]
Download Apache NiFi source
Download Apache NiFi source

After the package file has downloaded, the we need to extract it first. Just extract it to the directory we want. On this article, we will extract it to my own home directory. Just hit the command line : sudo tar -xvzf nifi-1.13.2-bin.tar.gz.

ramans@otodiginet:~$ sudo tar -xvzf nifi-1.13.2-bin.tar.gz
 [sudo] password for ramans: 
 nifi-1.13.2/README
 nifi-1.13.2/LICENSE
 nifi-1.13.2/NOTICE
 nifi-1.13.2/extensions/
 nifi-1.13.2/lib/javax.servlet-api-3.1.0.jar
 nifi-1.13.2/lib/jetty-schemas-3.1.jar
 nifi-1.13.2/lib/logback-classic-1.2.3.jar
 nifi-1.13.2/lib/logback-core-1.2.3.jar
 nifi-1.13.2/lib/jcl-over-slf4j-1.7.30.jar



Extract Apache NiFi package file
Extract Apache NiFi package file

On this tutorial the extracted files are located on /home/ramans/nifi-1.13.2/ directory.

Apache NiFi directory structure
Apache NiFi directory structure

3. Setting Java Environment

Actually we can just directly use Apache NiFi by calling it with the command line: sudo ./nifi.sh start from the ~/nifi-1.13.2/bin/ directory.

But to be more organized we will tidy it up by setting JAVA_HOME environment variable. We will edit the nifi-env.sh file by using vi editor for doing this.

Update nifi-env.sh file
Update nifi-env.sh file

4. Apache NiFi Testing

After all set, then we will try to use NiFi for the first time. On this step, we will startup, check the status and stop Apache NiFi.

Apache NiFi Starting up

Starting up Apache NiFi by submitting the command line : sudo nifi start

ramans@otodiginet:~/nifi-1.13.2/bin$ sudo nifi start
 Java home: /usr/lib/jvm/java-11-openjdk-amd64/
 NiFi home: /home/ramans/nifi-1.13.2
 Bootstrap Config File: /home/ramans/nifi-1.13.2/conf/bootstrap.conf
 WARNING: An illegal reflective access operation has occurred
 WARNING: Illegal reflective access by org.apache.nifi.bootstrap.util.OSUtils (file:/home/ramans/nifi-1.13.2/lib/bootstrap/nifi-bootstrap-1.13.2.jar) to method java.lang.ProcessImpl.pid()
 WARNING: Please consider reporting this to the maintainers of org.apache.nifi.bootstrap.util.OSUtils
 WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
 WARNING: All illegal access operations will be denied in a future release
Apache NiFi Start
Apache NiFi Start

For testing, we will use browser and open the url http://localhost:8080/nifi/.

Apache NiFi dashboard
Apache NiFi dashboard



4.2 Checking Apache NiFi

We also able to check the Apache NiFi daemon by using command line : sudo nifi status.

ramans@otodiginet:~/nifi-1.13.2/bin$ sudo nifi status
 Java home: /usr/lib/jvm/java-11-openjdk-amd64/
 NiFi home: /home/ramans/nifi-1.13.2
 Bootstrap Config File: /home/ramans/nifi-1.13.2/conf/bootstrap.conf
 2021-07-14 00:57:17,818 INFO [main] org.apache.nifi.bootstrap.Command Apache NiFi is currently running, listening to Bootstrap on port 36189, PID=16969
Apache NiFi Status
Apache NiFi Status
4.3 Stoping Apache NiFi

The last testing is to stop Apache Nifi, by using command line : sudo nifi stop.

ramans@otodiginet:~/nifi-1.13.2/bin$ sudo nifi stop
 Java home: /usr/lib/jvm/java-11-openjdk-amd64/
 NiFi home: /home/ramans/nifi-1.13.2
 Bootstrap Config File: /home/ramans/nifi-1.13.2/conf/bootstrap.conf
 2021-07-14 00:57:31,099 INFO [main] org.apache.nifi.bootstrap.Command Apache NiFi has accepted the Shutdown Command and is shutting down now
 2021-07-14 00:57:31,183 INFO [main] org.apache.nifi.bootstrap.Command Waiting for Apache NiFi to finish shutting down…
 2021-07-14 00:57:33,235 INFO [main] org.apache.nifi.bootstrap.Command Waiting for Apache NiFi to finish shutting down…
 2021-07-14 00:57:35,274 INFO [main] org.apache.nifi.bootstrap.Command Waiting for Apache NiFi to finish shutting down…
 2021-07-14 00:57:37,308 INFO [main] org.apache.nifi.bootstrap.Command Waiting for Apache NiFi to finish shutting down…
 2021-07-14 00:57:39,371 INFO [main] org.apache.nifi.bootstrap.Command Waiting for Apache NiFi to finish shutting down…
 2021-07-14 00:57:41,405 INFO [main] org.apache.nifi.bootstrap.Command Waiting for Apache NiFi to finish shutting down…
 2021-07-14 00:57:43,433 INFO [main] org.apache.nifi.bootstrap.Command Waiting for Apache NiFi to finish shutting down…
 2021-07-14 00:57:45,462 INFO [main] org.apache.nifi.bootstrap.Command Waiting for Apache NiFi to finish shutting down…
 2021-07-14 00:57:47,493 INFO [main] org.apache.nifi.bootstrap.Command Waiting for Apache NiFi to finish shutting down…
 2021-07-14 00:57:49,543 INFO [main] org.apache.nifi.bootstrap.Command Waiting for Apache NiFi to finish shutting down…
 2021-07-14 00:57:51,583 INFO [main] org.apache.nifi.bootstrap.Command Waiting for Apache NiFi to finish shutting down…
 2021-07-14 00:57:51,623 WARN [main] org.apache.nifi.bootstrap.Command NiFi has not finished shutting down after 20 seconds. Killing process.
 2021-07-14 00:57:51,664 INFO [main] org.apache.nifi.bootstrap.Command NiFi has finished shutting down.
Stoping Apache NiFi
Stoping Apache NiFi

Conclusion

On this article, we have shown you how to install Apache NiFi on Ubuntu 20.04 LTS operating system. For further information about apache NiFi can be found on Apache NiFi official website.

Share this article via :

Leave a Reply

Your email address will not be published. Required fields are marked *