【问题标题】:Install latest version of Sonarqube - Version: 7.9.1 LTS安装最新版本的 Sonarqube - 版本:7.9.1 LTS
【发布时间】:2025-11-20 13:55:02
【问题描述】:

我正在尝试在 Amazon Linux AWS EC2 中安装版本:Sonarqube 的 7.9.1 LTS。下面是我的 bash 脚本。

java -version openjdk version "11.0.2" 2019-01-15 LTS

脚本:-

$ wget https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-7.9.1.zip
$ sudo unzip sonarqube-7.9.1.zip -d /opt/sonar79
$ groupadd sonar
$ useradd -c "Sonar System User" -d /opt/sonar79 -g sonar -s /bin/bash sonar
$ chown -R sonar:sonar /opt/sonar79
$ cd opt/sonar76/sonarqube-7.9/bin/linux-x86-64/
$ sudo ./sonar.sh start

当我检查声纳的状态时,它说 - [ec2-user@ip-10-123-123-123 linux-x86-64]$ sudo ./sonar.sh status.SonarQube 没有运行。

请提出建议。 亚马逊 Linux 2 AMI 操作系统 错误日志:- --> Wrapper 作为守护进程启动

Launching a JVM...

Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org

Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.

WrapperSimpleApp: Encountered an error running main: java.lang.IllegalStateException: SonarQube requires Java 11+ to run

java.lang.IllegalStateException: SonarQube requires Java 11+ to run

at org.sonar.application.App.checkJavaVersion(App.java:93)

at org.sonar.application.App.start(App.java:56)

at org.sonar.application.App.main(App.java:98)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)

at java.lang.Thread.run(Thread.java:748)

<-- Wrapper Stopped

--> Wrapper Started as Daemon

Launching a JVM...

Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org

Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.

WrapperSimpleApp: Encountered an error running main: java.lang.IllegalStateException: SonarQube requires Java 11+ to run

java.lang.IllegalStateException: SonarQube requires Java 11+ to run

at org.sonar.application.App.checkJavaVersion(App.java:93)

at org.sonar.application.App.start(App.java:56)

at org.sonar.application.App.main(App.java:98)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)

at java.lang.Thread.run(Thread.java:748)

<-- Wrapper Stopped

--> Wrapper Started as Daemon

Launching a JVM...

Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org

Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.

2019.07.31 15:14:00 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonar79/sonarqube-7.9.1/temp

2019.07.31 15:14:00 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001

2019.07.31 15:14:00 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonar79/sonarqube-7.9.1/elasticsearch]: /opt/sonar79/sonarqube-7.9.1/elasticsearch/bin/elasticsearch

2019.07.31 15:14:00 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.

2019.07.31 15:14:01 INFO app[][o.e.p.PluginsService] no modules loaded

2019.07.31 15:14:01 INFO app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]

2019.07.31 15:14:07 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 1

2019.07.31 15:14:07 INFO app[][o.s.a.SchedulerImpl] Process[es] is stopped

2019.07.31 15:14:07 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped

<-- Wrapper Stopped

--> Wrapper Started as Daemon

Launching a JVM...

Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org

Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.

2019.07.31 15:19:07 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonar79/sonarqube-7.9.1/temp

2019.07.31 15:19:07 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001

2019.07.31 15:19:07 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonar79/sonarqube-7.9.1/elasticsearch]: /opt/sonar79/sonarqube-7.9.1/elasticsearch/bin/elasticsearch

2019.07.31 15:19:08 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.

2019.07.31 15:19:08 INFO app[][o.e.p.PluginsService] no modules loaded

2019.07.31 15:19:08 INFO app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]

2019.07.31 15:19:13 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 1

2019.07.31 15:19:13 INFO app[][o.s.a.SchedulerImpl] Process[es] is stopped

2019.07.31 15:19:13 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped

<-- Wrapper Stopped

--> Wrapper Started as Daemon

Launching a JVM...

Unable to start JVM: No such file or directory (2)

JVM exited while loading the application.

JVM Restarts disabled. Shutting down.

<-- Wrapper Stopped

--> Wrapper Started as Daemon

Launching a JVM...

Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org

Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.

2019.07.31 15:33:27 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonar79/sonarqube-7.9.1/temp

2019.07.31 15:33:27 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001

2019.07.31 15:33:27 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonar79/sonarqube-7.9.1/elasticsearch]: /opt/sonar79/sonarqube-7.9.1/elasticsearch/bin/elasticsearch

2019.07.31 15:33:27 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running

2019.07.31 15:33:28 INFO app[][o.e.p.PluginsService] no modules loaded

2019.07.31 15:33:28 INFO app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]

OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.

2019.07.31 15:33:33 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 1

2019.07.31 15:33:33 INFO app[][o.s.a.SchedulerImpl] Process[es] is stopped

2019.07.31 15:33:33 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped

<-- Wrapper Stopped

添加 es.log

cat /var/log/sonarqube/es.log 
2019.08.01 13:23:58 INFO  es[][o.e.e.NodeEnvironment] using [1] data paths, mounts [[/ (/dev/xvda1)]], net usable_space [17.6gb], net total_space [19.9gb], types [xfs]
2019.08.01 13:23:58 INFO  es[][o.e.e.NodeEnvironment] heap size [503.6mb], compressed ordinary object pointers [true]
2019.08.01 13:23:58 INFO  es[][o.e.n.Node] node name [sonarqube], node ID [BBdhW1RGRviya7qumPZjvg]
2019.08.01 13:23:58 INFO  es[][o.e.n.Node] version[6.8.0], pid[12840], build[default/tar/65b6179/2019-05-15T20:06:13.172855Z], OS[Linux/4.14.123-111.109.amzn2.x86_64/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/11.0.2/11.0.2+7-LTS]
2019.08.01 13:23:58 INFO  es[][o.e.n.Node] JVM arguments [-XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/usr/share/sonarqube/temp, -XX:ErrorFile=../logs/es_hs_err_pid%p.log, -Xms512m, -Xmx512m, -XX:+HeapDumpOnOutOfMemoryError, -Des.path.home=/usr/share/sonarqube/elasticsearch, -Des.path.conf=/usr/share/sonarqube/temp/conf/es, -Des.distribution.flavor=default, -Des.distribution.type=tar]
2019.08.01 13:23:59 INFO  es[][o.e.p.PluginsService] loaded module [analysis-common]
2019.08.01 13:23:59 INFO  es[][o.e.p.PluginsService] loaded module [lang-painless]
2019.08.01 13:23:59 INFO  es[][o.e.p.PluginsService] loaded module [mapper-extras]
2019.08.01 13:23:59 INFO  es[][o.e.p.PluginsService] loaded module [parent-join]
2019.08.01 13:23:59 INFO  es[][o.e.p.PluginsService] loaded module [percolator]
2019.08.01 13:23:59 INFO  es[][o.e.p.PluginsService] loaded module [reindex]
2019.08.01 13:23:59 INFO  es[][o.e.p.PluginsService] loaded module [repository-url]
2019.08.01 13:23:59 INFO  es[][o.e.p.PluginsService] loaded module [transport-netty4]
2019.08.01 13:23:59 INFO  es[][o.e.p.PluginsService] no plugins loaded
2019.08.01 13:24:03 WARN  es[][o.e.d.c.s.Settings] [http.enabled] setting was deprecated in Elasticsearch and will be removed in a future release! See the breaking changes documentation for the next major version.
2019.08.01 13:24:05 INFO  es[][o.e.d.DiscoveryModule] using discovery type [zen] and host providers [settings]
2019.08.01 13:24:06 INFO  es[][o.e.n.Node] initialized
2019.08.01 13:24:06 INFO  es[][o.e.n.Node] starting ...
2019.08.01 13:24:06 INFO  es[][o.e.t.TransportService] publish_address {127.0.0.1:9001}, bound_addresses {127.0.0.1:9001}
2019.08.01 13:24:06 WARN  es[][o.e.b.BootstrapChecks] max number of threads [3794] for user [sonarqube] is too low, increase to at least [4096]
2019.08.01 13:24:09 INFO  es[][o.e.c.s.MasterService] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {sonarqube}{BBdhW1RGRviya7qumPZjvg}{mluwgwiLScmoy8ecLjhySQ}{127.0.0.1}{127.0.0.1:9001}{rack_id=sonarqube}
2019.08.01 13:24:09 INFO  es[][o.e.c.s.ClusterApplierService] new_master {sonarqube}{BBdhW1RGRviya7qumPZjvg}{mluwgwiLScmoy8ecLjhySQ}{127.0.0.1}{127.0.0.1:9001}{rack_id=sonarqube}, reason: apply cluster state (from master [master {sonarqube}{BBdhW1RGRviya7qumPZjvg}{mluwgwiLScmoy8ecLjhySQ}{127.0.0.1}{127.0.0.1:9001}{rack_id=sonarqube} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]])
2019.08.01 13:24:09 INFO  es[][o.e.n.Node] started
2019.08.01 13:24:09 INFO  es[][o.e.g.GatewayService] recovered [0] indices into cluster_state
2019.08.01 13:24:10 INFO  es[][o.e.n.Node] stopping ...
2019.08.01 13:24:10 INFO  es[][o.e.n.Node] stopped
2019.08.01 13:24:10 INFO  es[][o.e.n.Node] closing ...
2019.08.01 13:24:10 INFO  es[][o.e.n.Node] closed
2019.08.01 13:25:34 INFO  es[][o.e.e.NodeEnvironment] using [1] data paths, mounts [[/ (/dev/xvda1)]], net usable_space [17.6gb], net total_space [19.9gb], types [xfs]
2019.08.01 13:25:34 INFO  es[][o.e.e.NodeEnvironment] heap size [503.6mb], compressed ordinary object pointers [true]
2019.08.01 13:25:34 INFO  es[][o.e.n.Node] node name [sonarqube], node ID [BBdhW1RGRviya7qumPZjvg]
2019.08.01 13:25:34 INFO  es[][o.e.n.Node] version[6.8.0], pid[13132], build[default/tar/65b6179/2019-05-15T20:06:13.172855Z], OS[Linux/4.14.123-111.109.amzn2.x86_64/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/11.0.2/11.0.2+7-LTS]
2019.08.01 13:25:34 INFO  es[][o.e.n.Node] JVM arguments [-XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/usr/share/sonarqube/temp, -XX:ErrorFile=../logs/es_hs_err_pid%p.log, -Xms512m, -Xmx512m, -XX:+HeapDumpOnOutOfMemoryError, -Des.path.home=/usr/share/sonarqube/elasticsearch, -Des.path.conf=/usr/share/sonarqube/temp/conf/es, -Des.distribution.flavor=default, -Des.distribution.type=tar]
2019.08.01 13:25:35 INFO  es[][o.e.p.PluginsService] loaded module [analysis-common]
2019.08.01 13:25:35 INFO  es[][o.e.p.PluginsService] loaded module [lang-painless]
2019.08.01 13:25:35 INFO  es[][o.e.p.PluginsService] loaded module [mapper-extras]
2019.08.01 13:25:35 INFO  es[][o.e.p.PluginsService] loaded module [parent-join]
2019.08.01 13:25:35 INFO  es[][o.e.p.PluginsService] loaded module [percolator]
2019.08.01 13:25:35 INFO  es[][o.e.p.PluginsService] loaded module [reindex]
2019.08.01 13:25:35 INFO  es[][o.e.p.PluginsService] loaded module [repository-url]
2019.08.01 13:25:35 INFO  es[][o.e.p.PluginsService] loaded module [transport-netty4]
2019.08.01 13:25:35 INFO  es[][o.e.p.PluginsService] no plugins loaded
2019.08.01 13:25:39 WARN  es[][o.e.d.c.s.Settings] [http.enabled] setting was deprecated in Elasticsearch and will be removed in a future release! See the breaking changes documentation for the next major version.
2019.08.01 13:25:41 INFO  es[][o.e.d.DiscoveryModule] using discovery type [zen] and host providers [settings]
2019.08.01 13:25:42 INFO  es[][o.e.n.Node] initialized
2019.08.01 13:25:42 INFO  es[][o.e.n.Node] starting ...
2019.08.01 13:25:42 INFO  es[][o.e.t.TransportService] publish_address {127.0.0.1:9001}, bound_addresses {127.0.0.1:9001}
2019.08.01 13:25:42 WARN  es[][o.e.b.BootstrapChecks] max number of threads [3794] for user [sonarqube] is too low, increase to at least [4096]
2019.08.01 13:25:46 INFO  es[][o.e.c.s.MasterService] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {sonarqube}{BBdhW1RGRviya7qumPZjvg}{GCf4Zh8mQQKbQNAI-1UBkA}{127.0.0.1}{127.0.0.1:9001}{rack_id=sonarqube}
2019.08.01 13:25:46 INFO  es[][o.e.c.s.ClusterApplierService] new_master {sonarqube}{BBdhW1RGRviya7qumPZjvg}{GCf4Zh8mQQKbQNAI-1UBkA}{127.0.0.1}{127.0.0.1:9001}{rack_id=sonarqube}, reason: apply cluster state (from master [master {sonarqube}{BBdhW1RGRviya7qumPZjvg}{GCf4Zh8mQQKbQNAI-1UBkA}{127.0.0.1}{127.0.0.1:9001}{rack_id=sonarqube} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]])
2019.08.01 13:25:46 INFO  es[][o.e.n.Node] started
2019.08.01 13:25:46 INFO  es[][o.e.g.GatewayService] recovered [0] indices into cluster_state
2019.08.01 13:25:46 INFO  es[][o.e.n.Node] stopping ...
2019.08.01 13:25:46 INFO  es[][o.e.n.Node] stopped
2019.08.01 13:25:46 INFO  es[][o.e.n.Node] closing ...
2019.08.01 13:25:46 INFO  es[][o.e.n.Node] closed

【问题讨论】:

  • 您能检查一下 SonarQube 日志目录中 es.log 文件中的内容吗?我怀疑以 root 身份运行 ElasticSearch 会出错,因此您可能需要使用 sudo -u sonar ./startsonar.bat 或类似方法以您创建的 sonar 用户身份启动 SonarQube。
  • @mc1arke 添加 es.log
  • 您检查过您的 Java 11+ 安装吗?
  • @JeroenHeier 谢谢。是的.. 它的11.0.2 我已经在我的问题中提到了:)

标签: java sonarqube java-service-wrapper


【解决方案1】:

正如您在Requirements page,Linux 的平台说明部分中所读到的,运行 SonarQube 的用户应该能够打开至少 4096 个线程。 es日志

用户 [sonarqube] 的最大线程数 [3794] 太低,请增加 至少 [4096]

也指向这一点。同一页面还提供了多种解决方案。其中之一是以 root 身份运行以下命令:

ulimit -u 4096

但是需要注意更多选项和更多限制。所以请仔细阅读该页面。

【讨论】: