title: FAILED TO WRITE PID installing Zookeeper
body: <p>I am new to Zookeeper and it has being a real issue to install it and run. I am not sure what is wrong in here but I will explain what I've being doing to make it more clear:</p>
  
  <p>1.- I've followed the installation guide provided by Apache. This means download the Zookeeper distribution (stable release) extracted the file and moved into the home directory.</p>
  
  <p>2.- As I am using Ubuntu 12.04 I've modified the .bashrc file including this:</p>
  
  <pre><code>export ZOOKEEPER_INSTALL=/home/myusername/zookeeper-3.4.5
  export PATH=$PATH:$ZOOKEEPER_INSTALL/bin
  </code></pre>
  
  <p>3.- Create a config file on conf/zoo.cfg</p>
  
  <pre><code>tickTime=2000
  dataDir=/var/zookeeper
  clientPort=2181
  </code></pre>
  
  <p>and also tried with:</p>
  
  <pre><code>dataDir=/var/log/zookeeper
  </code></pre>
  
  <p>and</p>
  
  <pre><code>dataDir=/var/bin/zookeeper
  </code></pre>
  
  <p>4.- When running the start command</p>
  
  <pre><code>zkServer.sh start or `bin/zkServer.sh start` nothing happens and always returns this
  
  JMX enabled by default
  Using config: /home/sasuke/zookeeper-3.4.5/bin/../conf/zoo.cfg
  mkdir: cannot create directory `/var/zookeeper': Permission denied
  Starting zookeeper ... /home/sasuke/zookeeper-3.4.5/bin/zkServer.sh: line 113: /var/zookeeper/zookeeper_server.pid: No such file or directory
  FAILED TO WRITE PID
  </code></pre>
  
  <p>I have Java installed and inside the zookeper directory there is a zookeeper.jar file that I think it's not running.
  Checking here on stackoverflow there was a guy that said he could run zookeeper after typing</p>
  
  <pre><code>ssh localhost
  </code></pre>
  
  <p>But when I try to do it I get this error</p>
  
  <pre><code>ssh: connect to host localhost port 22: Connection refused
  </code></pre>
  
  <p>Please help. I've being here trying to solve it for too long.</p>
  
  <p>Getting started guide of zookeeper:
  <a href="http://zookeeper.apache.org/doc/r3.1.2/zookeeperStarted.html" rel="noreferrer">http://zookeeper.apache.org/doc/r3.1.2/zookeeperStarted.html</a>
  Previous case solved with the shh localhost
  <a href="https://stackoverflow.com/questions/11092636/zookeeper-failed-to-write-pid">Zookeeper: FAILED TO WRITE PID</a></p>
  
  <p>UPDATE:
  The permissions for log are:</p>
  
  <pre><code>drwxr-xr-x 19 root root     4096 Oct 10 07:52 log
  </code></pre>
  
  <p>and for zookeeper:</p>
  
  <pre><code>drwxr-xr-x  2 zookeeper         zookeeper    4096 Mar 23  2012 zookeeper
  </code></pre>
  
  <p>Should I change any of these?</p>