Problems installing Sonarqube 6.7.4 LTS in Ubuntu Server 16.04

289 views
Skip to first unread message

Pierre Rodriguez Farias

unread,
Jun 6, 2018, 12:45:29 PM6/6/18
to SonarQube
Good day, I have a problem installing Sonarqube 6.7.4 LTS, I use Ubuntu Server 16.04, Mysql 5.7, Java8 JDK.

- Install Java with the following commands:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get -y install oracle-java8-installer

- Install MySql 5.7 with the following commands:

sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu trusty universe'
sudo apt-get update
sudo apt install mysql-server-5.7
sudo systemctl start mysql

- I create the database and the user with the respective permissions:

CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'sonar' IDENTIFIED BY 'sonar';
GRANT ALL ON sonar.* TO 'sonar'@'%' IDENTIFIED BY 'sonar';
GRANT ALL ON sonar.* TO 'sonar'@'localhost' IDENTIFIED BY 'sonar';
FLUSH PRIVILEGES;

Download the Sonarqube 6.7.4 LTS version from https://sonarsource.bintray.com/Distribution/sonarqube/ and configure the sonar.properties file in the path /opt/sonar/conf/sonar.properties:

sonar.jdbc.username=sonar
sonar.jdbc.password=sonar
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false

sonar.web.host=0.0.0.0
sonar.web.port=9000
sonar.web.context=/sonar

When the sonar.sh service is executed, the database migration is not performed (it is shown empty), the service is started for a few seconds and it is stopped. Implement the SonarQube server as a service but it still does not work.

The sonar.log file shows the following:

Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
  Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.

2018.06.05 17:13:42 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonar/temp
2018.06.05 17:13:42 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2018.06.05 17:13:42 INFO  app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonar/elasticsearch]: /opt/sonar/elasticsearch/bin/elasticsearch -Epath.conf=/opt/sonar/temp/conf/es
2018.06.05 17:13:42 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2018.06.05 17:13:43 INFO  app[][o.e.p.PluginsService] no modules loaded
2018.06.05 17:13:43 INFO  app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2018.06.05 17:13:44 WARN  app[][o.s.a.p.AbstractProcessMonitor] Process exited with exit value [es]: 1
2018.06.05 17:13:44 INFO  app[][o.s.a.SchedulerImpl] Process [es] is stopped
2018.06.05 17:13:44 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped
<-- Wrapper Stopped
--> Wrapper Started as Daemon

Please I need a support, I have several days with this case.

Eric Hartmann

unread,
Jun 6, 2018, 12:51:16 PM6/6/18
to pierr...@gmail.com, SonarQube
Hi Pierre,

I'm suspecting that your are trying to start SonarQube as root, you have to create a user and use that user to start SonarQube.
Can you add es.log to confirm that ?

Cheers,

Eric HARTMANN | SonarSource


--
Important: this SonarQube Google Group will close on June 11th, 2018, in order to move to a new forum to power even more community discussions. See details in this post: https://groups.google.com/d/msg/sonarqube/BbSZz-JnhVM/DavhMueEAAAJ
---
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/2bc18f55-7fa9-43b2-a646-5b1e03c03306%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Pierre Rodriguez Farias

unread,
Jun 6, 2018, 12:51:49 PM6/6/18
to sona...@googlegroups.com
Pierre Rodriguez

Pierre Rodriguez Farias

unread,
Jun 6, 2018, 12:58:59 PM6/6/18
to sona...@googlegroups.com
Hi Eric, I'm telling you that if I'm using the root user to start, I'll still send you the es.log file for your confirmation. Can the user that was created when installing Ubuntu 16.04 be used in the first instance?

2018.06.05 17:18:55 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

Could you tell me which is the correct procedure?

Thank you very much in advance.

Pierre Rodriguez

Eric Hartmann

unread,
Jun 6, 2018, 1:16:14 PM6/6/18
to pierr...@gmail.com, SonarQube
Hi Pierre,

Yes you can use the user created during installation of Ubuntu. And according to the exception, I confirm that you tried to start SonarQube as root.

Cheers,

Eric HARTMANN | SonarSource

--
Important: this SonarQube Google Group will close on June 11th, 2018, in order to move to a new forum to power even more community discussions. See details in this post: https://groups.google.com/d/msg/sonarqube/BbSZz-JnhVM/DavhMueEAAAJ
---
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.

Pierre Rodriguez Farias

unread,
Jun 6, 2018, 1:32:43 PM6/6/18
to Eric Hartmann, SonarQube
Hi Eric, use a non-root user but the same thing happened to me, the sonar.sh service starts for a few seconds and then stops. I send you the log es.log what it indicates, how I solve this problem. The es.log file shows the following:

"Caused by: java.lang.RuntimeException: can not run elasticsearch as root"

cat /opt/sonar/logs/es.log
2018.06.06 12:19:10 ERROR es [] [oebBootstrap] Excepción
java.lang.RuntimeException: no se puede ejecutar elasticsearch como root
        en org.elasticsearch.bootstrap.Bootstrap.initializeNatives (Bootstrap.java:106) ~ [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.bootstrap.Bootstrap.setup (Bootstrap.java:195) ~ [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.bootstrap.Bootstrap.init (Bootstrap.java:342) [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.bootstrap.Elasticsearch.init (Elasticsearch.java:132) [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.bootstrap.Elasticsearch.execute (Elasticsearch.java:123) [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.cli.EnvironmentAwareCommand.execute (EnvironmentAwareCommand.java:70) [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.cli.Command.mainWithoutErrorHandling (Command.java:134) [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.cli.Command.main (Command.java:90) [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.bootstrap.Elasticsearch.main (Elasticsearch.java:91) [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.bootstrap.Elasticsearch.main (Elasticsearch.java:84) [elasticsearch-5.6.3.jar: 5.6.3]
2018.06.06 12:19:10 WARN es [] [oebElasticsearchUncaughtExceptionHandler] excepción no detectada en el hilo [principal]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: no se puede ejecutar elasticsearch como root
        en org.elasticsearch.bootstrap.Elasticsearch.init (Elasticsearch.java:136) ~ [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.bootstrap.Elasticsearch.execute (Elasticsearch.java:123) ~ [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.cli.EnvironmentAwareCommand.execute (EnvironmentAwareCommand.java:70) ~ [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.cli.Command.mainWithoutErrorHandling (Command.java:134) ~ [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.cli.Command.main (Command.java:90) ~ [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.bootstrap.Elasticsearch.main (Elasticsearch.java:91) ~ [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.bootstrap.Elasticsearch.main (Elasticsearch.java:84) ~ [elasticsearch-5.6.3.jar: 5.6.3]
Causado por: java.lang.RuntimeException: no se puede ejecutar elasticsearch como root
        en org.elasticsearch.bootstrap.Bootstrap.initializeNatives (Bootstrap.java:106) ~ [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.bootstrap.Bootstrap.setup (Bootstrap.java:195) ~ [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.bootstrap.Bootstrap.init (Bootstrap.java:342) ~ [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.bootstrap.Elasticsearch.init (Elasticsearch.java:132) ~ [elasticsearch-5.6.3.jar: 5.6.3]
        ... 6 más


The sonar.log file shows the following:

--> 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.

2018.06.06 12:19:05 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonar/temp
2018.06.06 12:19:05 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2018.06.06 12:19:05 INFO  app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonar/elasticsearch]: /opt/sonar/elasticsearch/bin/elasticsearch -Epath.conf=/opt/sonar/temp/conf/es
2018.06.06 12:19:05 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2018.06.06 12:19:06 INFO  app[][o.e.p.PluginsService] no modules loaded
2018.06.06 12:19:06 INFO  app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2018.06.06 12:19:11 WARN  app[][o.s.a.p.AbstractProcessMonitor] Process exited with exit value [es]: 1
2018.06.06 12:19:11 INFO  app[][o.s.a.SchedulerImpl] Process [es] is stopped
2018.06.06 12:19:11 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped
<-- Wrapper Stopped

Pierre Rodriguez

To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+unsubscribe@googlegroups.com.

Pierre Rodriguez Farias

unread,
Jun 6, 2018, 4:20:49 PM6/6/18
to Eric Hartmann, SonarQube
Hola Eric, cambio el propietario del directorio /opt/sonar con mi usuario (no root)

ll /opt/
total 12
drwxr-xr-x 3 root root 4096 jun 6 14:34 ./
drwxr-xr-x 23 raíz raíz 4096 jun 5 09:43 ../
drwxr-xr-x 11 adminubuntu adminubuntu 4096 mayo 30 07:33 sonar /

Configure el archivo sonar.properties:

sonar.jdbc.username=sonar
sonar.jdbc.password=sonar
sonar.jdbc.url = jdbc: mysql://localhost:3306/sonar?useUnicode=true y characterEncoding=utf8&rewriteBatchedStatements= true&useConfigs=maxPerformance&useSSL=false
sonar.web.host="IP_Server"
sonar.web.context=/sonar
sonar.web.port=9000

Inicie el servicio sonar.sh pero solo comienza unos instantes y luego se detiene, con esto no puedo realizar la migración de la base de datos a Mysql. En el archivo es.log, muestra lo siguiente:

2018.06.06 14:38:30 ERROR es [] [oebBootstrap] Excepción
java.lang.RuntimeException: no se puede ejecutar elasticsearch como root
        en org.elasticsearch.bootstrap.Bootstrap.initializeNatives (Bootstrap.java:106) ~ [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.bootstrap.Bootstrap.setup (Bootstrap.java:195) ~ [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.bootstrap.Bootstrap.init (Bootstrap.java:342) [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.bootstrap.Elasticsearch.init (Elasticsearch.java:132) [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.bootstrap.Elasticsearch.execute (Elasticsearch.java:123) [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.cli.EnvironmentAwareCommand.execute (EnvironmentAwareCommand.java:70) [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.cli.Command.mainWithoutErrorHandling (Command.java:134) [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.cli.Command.main (Command.java:90) [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.bootstrap.Elasticsearch.main (Elasticsearch.java:91) [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.bootstrap.Elasticsearch.main (Elasticsearch.java:84) [elasticsearch-5.6.3.jar: 5.6.3]
2018.06.06 14:38:30 WARN es [] [oebElasticsearchUncaughtExceptionHandler] excepción no detectada en el hilo [principal]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: no se puede ejecutar elasticsearch como root
        en org.elasticsearch.bootstrap.Elasticsearch.init (Elasticsearch.java:136) ~ [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.bootstrap.Elasticsearch.execute (Elasticsearch.java:123) ~ [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.cli.EnvironmentAwareCommand.execute (EnvironmentAwareCommand.java:70) ~ [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.cli.Command.mainWithoutErrorHandling (Command.java:134) ~ [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.cli.Command.main (Command.java:90) ~ [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.bootstrap.Elasticsearch.main (Elasticsearch.java:91) ~ [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.bootstrap.Elasticsearch.main (Elasticsearch.java:84) ~ [elasticsearch-5.6.3.jar: 5.6.3]
Causado por: java.lang.RuntimeException: no se puede ejecutar elasticsearch como root
        en org.elasticsearch.bootstrap.Bootstrap.initializeNatives (Bootstrap.java:106) ~ [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.bootstrap.Bootstrap.setup (Bootstrap.java:195) ~ [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.bootstrap.Bootstrap.init (Bootstrap.java:342) ~ [elasticsearch-5.6.3.jar: 5.6.3]
        en org.elasticsearch.bootstrap.Elasticsearch.init (Elasticsearch.java:132) ~ [elasticsearch-5.6.3.jar: 5.6.3]
        ... 6 más


What do you think is the problem in this case, it indicates a problem with the java.lang.RuntimeException: can not run elasticsearch as root, please give me your support?

Pierre Rodriguez
Reply all
Reply to author
Forward
0 new messages