依赖jdk,先自行安装JDK
    1.解压文件
    tar zxvf apache-zookeeper-3.6.3-bin.tar.gz

    2.在主目录下创建data和logs两个目录用于存储数据和日志:
    cd /opt/apache-zookeeper-3.6.3-bin
    mkdir data mkdir logs

    3.在conf目录下新建zoo.cfg文件,写入以下内容保存:
    tickTime=2000 dataDir=/opt/apache-zookeeper-3.6.3-bin/data dataLogDir=/opt/apache-zookeeper-3.6.3-bin/logs clientPort=2181

    4.进入bin目录,启动、停止、重启分和查看当前节点状态(包括集群中是何角色)别执行:
    ./zkServer.sh start ./zkServer.sh stop ./zkServer.sh restart
    ./zkServer.sh status

    设置开机启动
    编辑以下文件
    chmod +x /etc/rc.local
    vi /etc/rc.local
    写入启动命令
    source /etc/profile;
    /opt/apache-zookeeper-3.6.3-bin/bin/zkServer.sh start;