SonarQube 7.7: Startup error: 'can not run elasticsearch as root'

I have just installed a brand new Ubuntu 18 system and have downloaded the SonarQube 7.7 bundle (first time install).

I have done the following:

  • Created user ‘sonarqube’
  • Extracted the files in /opt/sonarqube.
  • cd /opt/sonarqube
  • chown -R sonarqube:sonarqube * (screenshot below)
  • Edit /opt/sonarqube/bin/linux-x86-64/sonar.sh and add ‘RUN_AS_USER=sonarqube’ (screenshot below)
  • su as ‘sonarqube’
  • run /opt/sonarqube/bin/linux-x86-64/sonar.sh start

At this point I see:

Starting SonarQube…
“/opt/sonarqube-7.7/bin/linux-x86-64/./wrapper” “/opt/sonarqube-7.7/bin/linux-x86-64/…/…/conf/wrapper.conf” wrapper.syslog.ident=SonarQube wrapper.pidfile="/opt/sonarqube-7.7/bin/linux-x86-64/./SonarQube.pid" wrapper.daemonize=TRUE
Failed to start SonarQube.

and the exception in the es.log stating I ‘can not run elasticsearch as root’. I can’t find any other setting that controls the run_as user setting.

What am I missing?

I have also tried running the systemctl unit script which seems to bypass the ‘sonar.sh’ startups script by running the JAR file directly but I get the same error.

This is driving me crazy! Thanks for any help in advance.

image

image