title: Can't run Sonar Server caused by Elasticsearch cannot running as root
body: <p>I'm trying to install SonarQube : i ve followed those steps :</p>
  
  <p><a href="http://dev.mamikon.net/installing-sonarqube-on-ubuntu/" rel="noreferrer">Setting up SOnarQube Tuto : here</a></p>
  
  <p>To summarize it :</p>
  
  <ul>
  <li>Downloading Sonar and moving it to <code>/opt/sonar</code></li>
  <li><p>adding those coonfig steps to <code>/opt/sonar/conf/sonar.properties</code>  :</p>
  
  <p>sonar.jdbc.username=sonar
  sonar.jdbc.password=sonar</p></li>
  </ul>
  
  <p>sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&amp;characterEncoding=utf8&amp;rewriteBatchedStatements=true&amp;useConfigs=maxPerformance</p>
  
  <p><strong>and</strong></p>
  
  <pre><code>sonar.web.host=127.0.0.1
  sonar.web.context=/sonar
  sonar.web.port=9000
  </code></pre>
  
  <ul>
  <li>implementing <strong>sonar</strong> as a service:</li>
  </ul>
  
  <p>sudo cp /opt/sonar/bin/linux-x86-64/sonar.sh /etc/init.d/sonar</p>
  
  <pre><code>sudo gedit /etc/init.d/sonar
  </code></pre>
  
  <p><strong>Insert two new lines:</strong></p>
  
  <pre><code>SONAR_HOME=/opt/sonar
  PLATFORM=linux-x86-64
  Modify the following lines:
  
  WRAPPER_CMD="${SONAR_HOME}/bin/${PLATFORM}/wrapper"
  WRAPPER_CONF="${SONAR_HOME}/conf/wrapper.conf"
  </code></pre>
  
  <p><strong>...</strong></p>
  
  <pre><code>PIDDIR="/var/run"
  Register as a Linux service:
  
  sudo update-rc.d -f sonar remove
  sudo chmod 755 /etc/init.d/sonar
  sudo update-rc.d sonar defaults
  </code></pre>
  
  <p>After those steps : i ve tried to run Sonar from : <code>localhost:9000/sonar</code> and after executing : <code>sudo /etc/init.d/sonar start</code>
  `
  Strangely , it didsn't run .</p>
  
  <p>SO when i run `sudo /etc/init.d/sonar status , i discover that it goes steps after few seconds , and it throws some error in it log file , like the following :</p>
  
  <p><strong>es.log:</strong></p>
  
  <pre><code>2017.12.09 18:05:14 ERROR es[][o.e.b.Bootstrap] Exception
  java.lang.RuntimeException: can not run elasticsearch as root
      at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:106) ~[elasticsearch-5.6.3.jar:5.6.3]
      at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:195) ~[elasticsearch-5.6.3.jar:5.6.3]
      at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:342) [elasticsearch-5.6.3.jar:5.6.3]
      at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:132) [elasticsearch-5.6.3.jar:5.6.3]
      at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:123) [elasticsearch-5.6.3.jar:5.6.3]
      at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:70) [elasticsearch-5.6.3.jar:5.6.3]
      at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134) [elasticsearch-5.6.3.jar:5.6.3]
      at org.elasticsearch.cli.Command.main(Command.java:90) [elasticsearch-5.6.3.jar:5.6.3]
      at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) [elasticsearch-5.6.3.jar:5.6.3]
      at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) [elasticsearch-5.6.3.jar:5.6.3]
  2017.12.09 18:05:14 WARN  es[][o.e.b.ElasticsearchUncaughtExceptionHandler] uncaught exception in thread [main]
  org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
      at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) ~[elasticsearch-5.6.3.jar:5.6.3]
      at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:123) ~[elasticsearch-5.6.3.jar:5.6.3]
      at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:70) ~[elasticsearch-5.6.3.jar:5.6.3]
      at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134) ~[elasticsearch-5.6.3.jar:5.6.3]
      at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-5.6.3.jar:5.6.3]
      at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) ~[elasticsearch-5.6.3.jar:5.6.3]
      at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-5.6.3.jar:5.6.3]
  Caused by: java.lang.RuntimeException: can not run elasticsearch as root
      at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:106) ~[elasticsearch-5.6.3.jar:5.6.3]
      at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:195) ~[elasticsearch-5.6.3.jar:5.6.3]
      at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:342) ~[elasticsearch-5.6.3.jar:5.6.3]
      at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:132) ~[elasticsearch-5.6.3.jar:5.6.3]
      ... 6 more
  </code></pre>
  
  <p><strong>Any suggestions ??</strong></p>