Zookeeper is an open-source coordination service for distributed applications and can build upon to implement higher level services configuration maintenance, group, naming and synchronization. For more information refer the apache-Zookeeper page.

This post describes install zookeeper in your Linux machine, can support Ubuntu, Debian, CentOS, Fedora and etc.

Required Software:

ZooKeeper runs in Java 1.6 or greater (JDK 6 or greater). Install JAVA and set the JAVA_HOME environment path,

Now, Download JDK 1.8 version for 64-bit system and set JAVA_HOME path,


$ sudo wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u25-b17/jdk-8u25-linux-x64.tar.gz"
 

Extract file tar.gz,
 
$ sudo tar -xvf jdk-8u25-linux-x64.tar.gz

$ sudo mv  jdk1.8.0_25  /opt


Set java home path,

$ export JAVA_HOME=/opt/jdk1.8.0_25


also you need to add in ~/.bashrc file.
 
To make ensure the java path,


$ echo  $JAVA_HOME

/opt/jdk1.8.0_25

Now, download the zookeeper latest version using wget command,

$ sudo wget http://mirror.nus.edu.sg/apache/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz


Extract zookeeper file  zookeeper-3.4.6.tar.gz


$ sudo tar -zxvf  zookeeper-3.4.6.tar.gz

$ cd   zookeeper-3.4.6/config


Rename the cfg file now,


$ sudo mv zoo.cfg.sample  zoo.cfg

$ cd ..


Finally start the zookeeper service,

$sudo bin/zkServer.sh start

Check your zookeeper whether is it running or not,

$ sudo netstat -anplt | grep 2181