On 4/10/2018 10:39 AM, Gregorius Soedharmo wrote:
> I'm having problem installing Zookeeper as a service in Ubuntu, can you
> help by answering either of these stack exchange question?
>
> https://askubuntu.com/questions/1022575/what-is-the-proper-way-to-install-zookeeper-on-ubuntu-16-04-for-both-standalone
>
> https://devops.stackexchange.com/questions/3833/what-is-the-proper-way-to-install-zookeeper-on-ubuntu-16-04-for-both-standalone

Here's what I did on a CentOS system.  This could be adapted to Ubuntu. 
It's probably not the "proper" way to do it, but it worked for me.

First, I extracted the zookeeper tarball to /opt and renamed the
zookeeper-X.Y.Z directory to "zoo".

Then I created a little shell script at /usr/local/sbin/zkrun :

============
#!/bin/sh

# chkconfig: - 75 50
# description: Starts and stops ZK

cd /opt/zoo
bin/zkServer.sh $1
============

I made the script executable, and then created a symlink in the init.d
directory:

chmod +x /usr/local/sbin/zkrun
ln -s /usr/local/sbin/zkrun /etc/init.d/zookeeper

The following two commands activated the service for the next boot:

chkconfig --add zookeeper
chkconfig zookeeper on

Starting it was simple:

service zookeeper start

On Ubuntu, you can do something similar to what I did with chkconfig
using the update-rc.d command.  I don't know if that command looks for
comments in the script to determine where in the sequence to place the
startup and shutdown, but if it does, you could edit the script to
include those comments.

Or you could just install the zookeeper package that's included with
Ubuntu.  It's not the latest -- on an Ubuntu 16 system, I see version
3.4.8 in the repository.  It's not ancient.  3.4.11 is the newest stable
release.

Thanks,
Shawn

Reply via email to