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

Instructions are included below for both Ubuntu and CentOS. You'll just need to use one of them depending on your preference.

Ubuntu 20.04

The latest version of Ubuntu Server can be downloaded from here. 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

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

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)

CentOS 8

The latest version of CentOS 8 can be downloaded from here. Documentation on the installer can be found here. Similar to Ubuntu, I'd recommend at least 2 GB of RAM since NiFi will grab around 1 GB when it starts up.

Update all the packages on the system once the installer is finished:

sudo yum update
sudo reboot

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

sudo yum install java-11-openjdk-headless

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

[nlabadie@centos ~]$ java -version
openjdk version "11.0.12" 2021-07-20 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.12+7-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.12+7-LTS, mixed mode, sharing)

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.14.0-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 ~
wget https://dlcdn.apache.org/nifi/1.14.0/nifi-1.14.0-bin.tar.gz
tar vzxf nifi-1.14.0-bin.tar.gz
sudo mv nifi-1.14.0 /opt
sudo ln -s /opt/nifi-1.14.0 /opt/nifi
cd /opt/nifi
sudo bin/nifi.sh install

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

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

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

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

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