Note: I followed all these steps in Elementary OS which is a Linux distribution based on Ubuntu. This should work in Ubuntu as well.
Download the Flink version that matches your Hadoop version. I will download Flink 0.9.0 for Hadoop 2.6 because I have Hadoop 2.6 setup in my machine.
The download location is here
sudo wget http://www.apache.org/dyn/closer.cgi/flink/flink-0.9.0/flink-0.9.0-bin-hadoop26.tgz
2.Extract the tgz file. Note: modify the flink file name to match the filename that you downloaded.
sudo tar xvzf flink-0.9.0-bin-hadoop26.tgz
This will extract the tgz file into a folder depending on the version that you downloaded.
3.Create a folder in /usr/local directory.
sudo mkdir -p /usr/local/flink
The above command will create a folder called “flink” in /usr/local
4.Copy the flink extracted files to /usr/local/flink
cd flink-0.9.0-bin.hadoop26 sudo mv * /usr/local/flink/
4.Give user permission to the flink folder. In the below two commands, we are navigating to /usr/local folder and giving permission to “hduser” of the user group “hadoop”. Modify the user:usergroup if you want.
cd /usr/local sudo chown hduser:hadoop flink
5.Add the flink paths in ~/.bashrc file. First open the .bashrc using an editor of your choise. Here I am using gedit.
sudo gedit ~/.bashrc
6.Add the following details in the .bashrc file at complete end of the file.
#FLINK VARIABLES START FLINK_HOME=/usr/local/flink export PATH=$PATH:$FLINK_HOME/bin #FLINK VARIABLES END
7.Execute the .bashrc file
8.Done, you can start using flink in your machine.