Firstly download ZooKeeper from the following link:
http://mirror.nus.edu.sg/apache/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz
Unzip the downloaded file and put the unzipped folder in a folder, say the following
$HOME/Documents/Works/ZooKeeper/zookeeper-3.4.6
Now go the the $HOME directory and run the following command to open the .bashrc file in terminal:
> gedit .bashrc
In the .bashrc file, add the following line to the end:
export ZK_HOME=$HOME/Documents/Works/ZooKeeper/zookeeper-3.4.6
Save and close the .bashrc file, run the following command to update the environment var:
> source .bashrc
Now run the following command to go to the $ZK_HOME/conf directory
> cd $ZK_HOME/conf
Run the following command to create the configuration zoo.cfg:
> touch zoo.cfg
> gedit zoo.cfg
In the zoo.cfg opened, add the following lines:
tickTime=2000
dataDir=/tmp/zookeeper
clientPort=2181
Save and close zoo.cfg, go back to the ZooKeeper home directory:
> cd $ZK_HOME
Run the following command to start the zookeeper on the machine:
> bin/zkServer.sh start
Run the following command to check the java process running:
> jps
Run the following command to check the status of zookeeper:
> bin/zkServer.sh status
Run the following command to stop the zookeeper:
> bin/zkServer.sh stop