Sonarqube installation error on ubuntu

Hello Team .

I have installed java 11.07 on ubuntu and also i have installed sonar7.9.3 version .
I have created a login vnext apaprt from root user

./sonar.sh status
SonarQube is running (10905).
vnext@ubuntu:/opt/sonarqube/bin/linux-x86-64$ java -version
openjdk version "11.0.7" 2020-04-14
OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-2ubuntu218.04)
OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-2ubuntu218.04, mixed mode, sharing)

but i am gettitng this error below

tail -f sonar.log 
2020.07.17 15:30:04 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2020.07.17 15:30:04 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2020.07.17 15:30:04 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch
2020.07.17 15:30:04 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
2020.07.17 15:30:05 INFO  app[][o.e.p.PluginsService] no modules loaded
2020.07.17 15:30:05 INFO  app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2020.07.17 15:30:11 WARN  app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 1
2020.07.17 15:30:11 INFO  app[][o.s.a.SchedulerImpl] Process[es] is stopped
2020.07.17 15:30:11 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped
<-- Wrapper Stopped
--> Wrapper Started as Daemon

tail -f es.log 
vnext@ubuntu:/opt/sonarqube/logs$ tail -f es.log
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.8.0.jar:6.8.0]
        at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.8.0.jar:6.8.0]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116) ~[elasticsearch-6.8.0.jar:6.8.0]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.8.0.jar:6.8.0]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
        at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:103) ~[elasticsearch-6.8.0.jar:6.8.0]
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:170) ~[elasticsearch-6.8.0.jar:6.8.0]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333) ~[elasticsearch-6.8.0.jar:6.8.0]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-6.8.0.jar:6.8.0]
        ... 6 more
2020.07.17 15:31:08 ERROR es[][o.e.b.Bootstrap] Exception

Hi,

The error is telling you that SonarQube somehow is running as root. It’s not clear to me how you’re starting SonarQube. You’ll need to make sure you’re executing the start script as the user you created.

 
HTH,
Ann

I have created a local user as Sonar but still getting the same error

Hi @smart_admin

can you please:

  • stop sonarqube
  • restart the complete vm/system
  • change the ownership of the sonarqube installation to the user that should execute it with:
    sudo chown -R vnext: /opt/sonarqube
  • start sonarqube with the following command:
    sudo su -c '/opt/sonarqube/bin/linux-x86-64/sonar.sh start' vnext

and if sonarqube is crashing again, please post the whole log file of es.log, web.log and sonar.log