The Basics: How Do I Install Apache NiFi?

The Basics: How Do I Install Apache NiFi?

Summary

I've written a few different guides on common use cases that can be accomplished with Apache NiFi. I probably should have started with the first basic questions: how do I get it installed? Fortunately the setup process is extremely simple. I'm using Ubuntu 20.04 in this example, but the instructions should be similar for most other Linux distributions.

Installation

Ubuntu 20.04

Ubuntu 20.04 can be downloaded from here. You'll want to use the "server install image" since we don't need a desktop environment. Ubuntu provides plenty of documentation on the server install. Personally, I'd recommend at least 2 GB of RAM since NiFi will grab around 1 GB when it starts up.

You'll first want to update all the packages on the system. Generally this is followed by a reboot if there's a kernel update.

sudo apt-get update && sudo apt-get -y dist-upgrade && sudo apt-get autoremove -y && sudo apt-get clean
sudo reboot
Update Ubuntu.

NiFi requires Java 8 or Java 11. After the reboot from above, we'll install OpenJDK 11 onto Ubuntu:

sudo apt install openjdk-11-jdk-headless
Install OpenJDK.

Assuming everything installed as expected, you should be able to run the java command and view the resulting version number.

nlabadie@dev-nifi:~$ java -version
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)
Check Java.

Installing NiFi

At present, the current version of NiFi is 1.11.4 released on March 22, 2020. You can substitute the URL below with the latest version. Go to the NiFi download page, search for the latest version, and click on the link for the tar.gz file listed under "Binaries", e.g. nifi-1.11.4-bin.tar.gz.

You'll then be presented with a download URL at the top of the page. Copy that URL and go back to Ubuntu. You'll want to swap out the URL below from the one you copied from the previous steps. Keep in mind this was written for NiFi 1.11.4, so you'll also want to change the version numbers below if NiFi has been updated.

cd /tmp
wget https://mirror.olnevhost.net/pub/apache/nifi/1.11.4/nifi-1.11.4-bin.tar.gz
tar vzxf nifi-1.11.4-bin.tar.gz
sudo mv nifi-1.11.4 /opt
sudo ln -s /opt/nifi-1.11.4 /opt/nifi
cd /opt/nifi
sudo bin/nifi.sh install
Install NiFi.

At this point NiFi is installed but not started. I'll typically give it just a bit more RAM before starting it up.

sudo vi /opt/nifi/conf/bootstrap.conf
NiFi configuration.

You'll want to change the following values. Just be sure the values match to have the same amount of RAM assigned.

# The defaults.
# JVM memory settings
java.arg.2=-Xms512m
java.arg.3=-Xmx512m

# If you wanted to change it to 1 GB each:
# JVM memory settings
java.arg.2=-Xms1g
java.arg.3=-Xmx1g
Change NiFi RAM settings.

There shouldn't be much else to the configuration, at least for testing purposes. You can now start up NiFi:

sudo /etc/init.d/nifi start
NiFi startup.

It'll take a minute before the UI is available. You can watch the start-up process with the following command:

tail -f /opt/nifi/logs/nifi-bootstrap.log
Startup logs.

Conclusion

Assuming there aren't any issues, NiFi can be access through your browser by going to port 8080 on HTTP. For example, if NiFi was installed on the host nifi.domain.corp then the URL would be http://nifi.domain.corp:8080/nifi.

NiFi dashboard.

Hope this helps!

Show Comments