Cyberithub

Easy Steps to Install Apache Nifi on Ubuntu 20.04

Advertisements

In this article, we will go through the steps to install Apache Nifi on Ubuntu 20.04. Nifi is an open source Apache Project built to automate the flow of data between Systems. Since 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.

Easy Steps to Install Apache Nifi on Ubuntu 20.04

Easy Steps to Install Apache Nifi on Ubuntu 20.04

Also Read: Step by Step Guide to Deploy a website on GKE(Google Kubernetes Engine)

Advertisements

Step 1: Prerequisites

a) You should have a running Ubuntu 20.04 Server.

b) You should have sudo or root access to run privileged commands.

Advertisements

c) You should have OpenJDK 11 installed in your Server.

d) You should have apt or apt-get, wget and tar utility installed in your Server.

Advertisements

Step 2: Update Your Server

If you have not updated your Ubuntu Server from long time, then it is always a good idea to run the update once using apt-get update command. This will synchronize your installed packages with the latest version.

root@localhost:~# apt-get update
Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [109 kB]
Hit:2 http://in.archive.ubuntu.com/ubuntu focal InRelease
Get:3 http://in.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:4 http://in.archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [983 kB]
Get:6 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [655 kB]
Get:7 http://in.archive.ubuntu.com/ubuntu focal-updates/main i386 Packages [474 kB]
Get:8 http://in.archive.ubuntu.com/ubuntu focal-updates/main Translation-en [222 kB]
Get:9 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [263 kB]
Get:10 http://in.archive.ubuntu.com/ubuntu focal-updates/main DEP-11 48x48 Icons [55.6 kB]
Get:11 http://in.archive.ubuntu.com/ubuntu focal-updates/main DEP-11 64x64 Icons [87.9 kB]
Get:12 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 c-n-f Metadata [13.3 kB]
Get:13 http://in.archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [226 kB]
Get:14 http://in.archive.ubuntu.com/ubuntu focal-updates/restricted Translation-en [33.3 kB]
Get:15 http://in.archive.ubuntu.com/ubuntu focal-updates/universe i386 Packages [572 kB]
Get:16 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [774 kB]
Get:17 http://in.archive.ubuntu.com/ubuntu focal-updates/universe Translation-en [166 kB]
Get:18 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 DEP-11 Metadata [323 kB]
Get:19 http://in.archive.ubuntu.com/ubuntu focal-updates/universe DEP-11 48x48 Icons [204 kB]
Get:20 http://in.archive.ubuntu.com/ubuntu focal-updates/universe DEP-11 64x64 Icons [362 kB]
Get:21 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 c-n-f Metadata [17.4 kB]

 

Step 3: Download Apache Nifi Using wget

You can download latest Apache Nifi version from Download Page using wget utility as shown below. Then you can verify the downloaded package using ls -ltr nifi-1.13.2-bin.tar.gz command.

Advertisements
root@localhost:~# wget https://apachemirror.wuchna.com/nifi/1.13.2/nifi-1.13.2-bin.tar.gz
--2021-05-15 20:24:09-- https://apachemirror.wuchna.com/nifi/1.13.2/nifi-1.13.2-bin.tar.gz
Resolving apachemirror.wuchna.com (apachemirror.wuchna.com)... 143.110.177.196
Connecting to apachemirror.wuchna.com (apachemirror.wuchna.com)|143.110.177.196|: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 2.40MB/s in 11m 6s

2021-05-15 20:35:16 (2.26 MB/s) - ‘nifi-1.13.2-bin.tar.gz’ saved [1576430190/1576430190]

root@localhost:~# ls -ltr nifi-1.13.2-bin.tar.gz
-rw-r--r-- 1 root root 1576430190 Mar 18 10:57 nifi-1.13.2-bin.tar.gz

 

Step 4: Extract Package using tar utility

Since we have downloaded the package in compressed format, so we need to extract it first. You can extract it by using tar -xvf nifi-1.13.2-bin.tar.gz command as shown below. It will extract all the packages in current directory.

root@localhost:~# tar -xvf nifi-1.13.2-bin.tar.gz
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
nifi-1.13.2/lib/jul-to-slf4j-1.7.30.jar
nifi-1.13.2/lib/log4j-over-slf4j-1.7.30.jar

 

Step 5: Set JAVA_HOME Path

If you don't have JAVA_HOME environment variable set, then you need to set it with the OpenJDK path. In my setup it is on /usr/lib/jvm/java-11-openjdk-amd64/, so we will set the variable path and export it using below given command.

root@localhost:~# export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/

Once set you can verify the path by using echo $JAVA_HOME command. You can also set JAVA_HOME variable inside nifi-env.sh file to avoid setting it again and again from the command line. You can find nifi-env.sh file under extracted bin/ directory.

root@localhost:~# echo $JAVA_HOME
/usr/lib/jvm/java-11-openjdk-amd64/

 

Step 6: Start Apache Nifi

Then go to Nifi bin directory and start the Server by using ./nifi.sh start command as mentioned below. By default it will start listening on Port 8080. So you need to make sure this port is not blocked in your Firewall. If it is indeed block, then you can simply allow this port using ufw allow 8080 command.

root@localhost:~# cd nifi-1.13.2/bin/
root@localhost:~/nifi-1.13.2/bin# ./nifi.sh start

Java home: /usr/lib/jvm/java-11-openjdk-amd64/
NiFi home: /root/nifi-1.13.2

Bootstrap Config File: /root/nifi-1.13.2/conf/bootstrap.conf

NOTE:

Please be very careful on allowing port from firewall in Production environment.

Now you can Go to your Browser and open localhost:8080/nifi URL as shown below.

Easy Steps to Install Apache Nifi on Ubuntu 20.04 2

Step 7: Stop Apache Nifi

If you want to stop Apache Nifi Server, then you need to use ./nifi.sh stop command as shown below.

root@localhost:~/nifi-1.13.2/bin# ./nifi.sh stop

Java home: /usr/lib/jvm/java-11-openjdk-amd64/
NiFi home: /root/nifi-1.13.2

Bootstrap Config File: /root/nifi-1.13.2/conf/bootstrap.conf

2021-05-15 22:04:27,944 INFO [main] org.apache.nifi.bootstrap.Command Apache NiFi has accepted the Shutdown Command and is shutting down now
2021-05-15 22:04:28,181 INFO [main] org.apache.nifi.bootstrap.Command Waiting for Apache NiFi to finish shutting down...
2021-05-15 22:04:30,194 INFO [main] org.apache.nifi.bootstrap.Command Waiting for Apache NiFi to finish shutting down...
2021-05-15 22:04:32,203 INFO [main] org.apache.nifi.bootstrap.Command NiFi has finished shutting down.

Leave a Comment