I’m trying to install Sonarqube 7.9 on Centos7 on a VPS with 4GB of RAM
I’m using PostreSQL 10 and Java 11
What have i done :
Create a separate user (sonar)
Create the role and the database (sonarqube_db) in postgresql
Download and unzip sonarqube to /opt/sonarqube
I gave the chown of /opt/sonarqube/ to sonar user
I have change the sonar.properties file with these lines
sonar.jdbc.username=sonar
sonar.jdbc.password=/mysonarpsswd/
sonar.jdbc.url=jdbc:mysql://localhost/sonarqube_db?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
sonar.web.host=127.0.0.1
sonar.web.port=9000
sonar.search.javaOpts=-Xms2g -Xmx2g -XX:+HeapDumpOnOutOfMemoryError
(i have tried without the 3 last lines too)
in /opt/sonarqube/bin/linux-x86-64/sonar.sh
i put
RUN_AS_USER=sonar
in /etc/security/limits.conf, I put
elasticsearch soft nofile 65536
elasticsearch hard nofile 65536
sonar soft nofile 65536
sonar hard nofile 65536
I created /etc/systemd/system/sonar.service and put
[Unit]
Description=SonarQube service
After=syslog.target network.target
[Install]
WantedBy=multi-user.target
-then i do an enable of the service, and restart the machine.
here are my results …
tail /opt/sonarqube/logs/sonar.log
Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.
TERM trapped. Shutting down.
2019.10.24 14:36:40 INFO app[o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2019.10.24 14:36:40 INFO app[o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2019.10.24 14:36:40 INFO app[o.s.a.ProcessLauncherImpl] Launch process[[key=‘es’, ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch
2019.10.24 14:36:40 INFO app[o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2019.10.24 14:36:41 INFO app[o.e.p.PluginsService] no modules loaded
2019.10.24 14:36:41 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.
Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.
TERM trapped. Shutting down.
2019.10.24 14:36:40 INFO app[o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2019.10.24 14:36:40 INFO app[o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2019.10.24 14:36:40 INFO app[o.s.a.ProcessLauncherImpl] Launch process[[key=‘es’, ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch
2019.10.24 14:36:40 INFO app[o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2019.10.24 14:36:41 INFO app[o.e.p.PluginsService] no modules loaded
2019.10.24 14:36:41 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.10.24 14:36:40 INFO app[o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2019.10.24 14:36:40 INFO app[o.s.a.ProcessLauncherImpl] Launch process[[key=‘es’, ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch
2019.10.24 14:36:40 INFO app[o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2019.10.24 14:36:41 INFO app[o.e.p.PluginsService] no modules loaded
2019.10.24 14:36:41 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.10.24 14:36:42 WARN app[o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 143
2019.10.24 14:36:42 INFO app[o.s.a.SchedulerImpl] Process[es] is stopped
2019.10.24 14:36:42 INFO app[o.s.a.SchedulerImpl] SonarQube is stopped
this is always the same loop of errors
here are my logs (as i don’t have more informations … )
ls /opt/sonarqube/logs/
sonar.log
I have search in a lot of topics but i did’nt found anything matching my case, if anyone have an idea it would be great.
sonar.jdbc.url=jdbc:mysql://localhost/sonarqube_db?useUnicode=true&characterEncoding=utf8& was copied from a bad saving my bad, the link is sonar.jdbc.url=jdbc:postgresql://localhost/sonarqube_db
Thanks for the suggestion, i’ll try this and post the result here, but what is unusual in the service command?
Lauching java with a specific jar file is also compatible with Supervisord (if you want to be able to stop/start the Sonar service from a web interface).
Oct 25 12:01:30 nohup[4504]: 2019.10.25 12:01:30 INFO app[o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
Oct 25 12:01:30 nohup[4504]: 2019.10.25 12:01:30 INFO app[o.e.p.PluginsService] no modules loaded
Oct 25 12:01:30 nohup[4504]: 2019.10.25 12:01:30 INFO app[o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
Oct 25 12:01:31 nohup[4504]: OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
Oct 25 12:02:03 nohup[4504]: 2019.10.25 12:02:03 INFO app[o.s.a.SchedulerImpl] Process[es] is up
Oct 25 12:02:03 nohup[4504]: 2019.10.25 12:02:03 INFO app[o.s.a.ProcessLauncherImpl] Launch process[[key=‘web’, ipcIndex=2, logFilenamePrefix=web]] from [/opt/sonarqube]: /usr/lib/jvm/java-11-openjdk-11.0.5.10-0.el7_7.x86_64/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.|[::1] -cp ./lib/common/:/opt/sonarqube/lib/jdbc/postgresql/postgresql-42.2.5.jar org.sonar.server.app.WebServer /opt/sonarqube/temp/sq-process15279172857290189595properties
Oct 25 12:02:42 nohup[4504]: 2019.10.25 12:02:42 INFO app[o.s.a.SchedulerImpl] Process[web] is up
Oct 25 12:02:42 nohup[4504]: 2019.10.25 12:02:42 INFO app[o.s.a.ProcessLauncherImpl] Launch process[[key=‘ce’, ipcIndex=3, logFilenamePrefix=ce]] from [/opt/sonarqube]: /usr/lib/jvm/java-11-openjdk-11.0.5.10-0.el7_7.x86_64/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp --add-opens=java.base/java.util=ALL-UNNAMED -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.|[::1] -cp ./lib/common/:/opt/sonarqube/lib/jdbc/postgresql/postgresql-42.2.5.jar org.sonar.ce.app.CeServer /opt/sonarqube/temp/sq-process11634739157322383870properties
Oct 25 12:02:58 4504]: 2019.10.25 12:02:58 INFO app[o.s.a.SchedulerImpl] Process[ce] is up
Oct 25 12:02:58nohup[4504]: 2019.10.25 12:02:58 INFO app[o.s.a.SchedulerImpl] SonarQube is up
sonar.log says :
2019.10.25 12:01:29 INFO app[o.s.a.ProcessLauncherImpl] Launch process[[key=‘es’, ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch
2019.10.25 12:01:30 INFO app[o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2019.10.25 12:01:30 INFO app[o.e.p.PluginsService] no modules loaded
2019.10.25 12:01:30 INFO app[o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2019.10.25 12:02:03 INFO app[o.s.a.SchedulerImpl] Process[es] is up
2019.10.25 12:02:03 INFO app[o.s.a.ProcessLauncherImpl] Launch process[[key=‘web’, ipcIndex=2, logFilenamePrefix=web]] from [/opt/sonarqube]: /usr/lib/jvm/java-11-openjdk-11.0.5.10-0.el7_7.x86_64/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.|[::1] -cp ./lib/common/:/opt/sonarqube/lib/jdbc/postgresql/postgresql-42.2.5.jar org.sonar.server.app.WebServer /opt/sonarqube/temp/sq-process15279172857290189595properties
2019.10.25 12:02:42 INFO app[o.s.a.SchedulerImpl] Process[web] is up
2019.10.25 12:02:42 INFO app[o.s.a.ProcessLauncherImpl] Launch process[[key=‘ce’, ipcIndex=3, logFilenamePrefix=ce]] from [/opt/sonarqube]: /usr/lib/jvm/java-11-openjdk-11.0.5.10-0.el7_7.x86_64/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp --add-opens=java.base/java.util=ALL-UNNAMED -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.|[::1] -cp ./lib/common/:/opt/sonarqube/lib/jdbc/postgresql/postgresql-42.2.5.jar org.sonar.ce.app.CeServer /opt/sonarqube/temp/sq-process11634739157322383870properties
2019.10.25 12:02:58 INFO app[o.s.a.SchedulerImpl] Process[ce] is up
2019.10.25 12:02:58 INFO app[o.s.a.SchedulerImpl] SonarQube is up
es.log says :
2019.10.25 12:01:52 INFO es[o.e.d.DiscoveryModule] using discovery type [zen] and host providers [settings]
2019.10.25 12:01:53 INFO es[o.e.n.Node] initialized
2019.10.25 12:01:53 INFO es[o.e.n.Node] starting …
2019.10.25 12:01:54 INFO es[o.e.t.TransportService] publish_address {127.0.0.1:9001}, bound_addresses {127.0.0.1:9001}
2019.10.25 12:01:54 INFO es[o.e.b.BootstrapChecks] explicitly enforcing bootstrap checks
2019.10.25 12:01:57 INFO es[o.e.c.s.MasterService] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {sonarqube}{hv4vbb9qQ1izHkjbWyYr5g}{_oZVwvQxRQmpnqu6mCCxSw}{127.0.0.1}{127.0.0.1:9001}{rack_id=sonarqube}
2019.10.25 12:01:57 INFO es[o.e.c.s.ClusterApplierService] new_master {sonarqube}{hv4vbb9qQ1izHkjbWyYr5g}{_oZVwvQxRQmpnqu6mCCxSw}{127.0.0.1}{127.0.0.1:9001}{rack_id=sonarqube}, reason: apply cluster state (from master [master {sonarqube}{hv4vbb9qQ1izHkjbWyYr5g}{_oZVwvQxRQmpnqu6mCCxSw}{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.10.25 12:01:57 INFO es[o.e.n.Node] started
2019.10.25 12:01:59 INFO es[o.e.g.GatewayService] recovered [7] indices into cluster_state
2019.10.25 12:02:02 INFO es[o.e.c.r.a.AllocationService] Cluster health status changed from [RED] to [GREEN] (reason: [shards started [[metadatas][0]] …]).
and web.log says :
2019.10.25 12:02:41 INFO web[o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.ws.DeprecatedPropertiesWsFilter@3467a8ee [pattern=UrlPattern{inclusions=[/api/properties/], exclusions=[]}]
2019.10.25 12:02:41 INFO web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.ws.WebServiceReroutingFilter@3327e595 [pattern=UrlPattern{inclusions=[/api/components/bulk_update_key, …], exclusions=[]}]
2019.10.25 12:02:41 INFO web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.authentication.InitFilter@7a123cfc [pattern=UrlPattern{inclusions=[/sessions/init/], exclusions=}]
2019.10.25 12:02:41 INFO web[o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.authentication.OAuth2CallbackFilter@43e1fc17 [pattern=UrlPattern{inclusions=[/oauth2/callback/*], exclusions=}]
2019.10.25 12:02:41 INFO web[o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.authentication.ws.LoginAction@62e5af90 [pattern=UrlPattern{inclusions=[/api/authentication/login], exclusions=}]
2019.10.25 12:02:41 INFO web[o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.authentication.ws.LogoutAction@54adb11b [pattern=UrlPattern{inclusions=[/api/authentication/logout], exclusions=}]
2019.10.25 12:02:41 INFO web[o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.authentication.ws.ValidateAction@4ee925f6 [pattern=UrlPattern{inclusions=[/api/authentication/validate], exclusions=}]
2019.10.25 12:02:42 INFO web[o.s.s.q.ProjectsInWarningDaemon] Counting number of projects in warning is not started as there are no projects in this situation.
2019.10.25 12:02:42 INFO web[o.s.s.p.p.PlatformLevelStartup] Running Community Edition
2019.10.25 12:02:42 INFO web[o.s.s.p.Platform] WebServer is operational
i guess everything should be alright, but i still can’t connect with any browser … (with http:myip:9000 && i have opened the port)
the logs i’ve written here are the log after many unsuccessfull tries.
I’m still investigating … do you think that it could be the memory of the JVM is too low?
(here is my exec line)
ExecStart=/bin/nohup /usr/bin/java -Xms32m -Xmx32m -Djava.net.preferIPv4Stack=true -jar /opt/sonarqube/lib/sonar-application-7.9.jar