• Download
  [plaintext]
1
wget https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-6.2.zip
  • unzip
  [plaintext]
1
unzip sonarqube-6.2.zip
  • config mysql

create user sonar in mysql

  [plaintext]
1
2
3
CREATE USER sonar IDENTIFIED BY 'sonar'; GRANT ALL PRIVILEGES ON *.* TO 'sonar'@'localhost' IDENTIFIED BY 'sonar' WITH GRANT OPTION;

create database sonar

  [plaintext]
1
CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci;

copy mysql-connector-java-5.1.38.jar into

  [plaintext]
1
/home/hbb/tool/sonar/sonarqube-6.2/extensions/jdbc-driver/mysql/
  • edit ~/conf/sonar.properties

add content like this:

  [plaintext]
1
2
3
4
5
# set for sonar sonar.jdbc.driverClassName: com.mysql.jdbc.Driver sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8 sonar.jdbc.username=sonar sonar.jdbc.password=sonar
  • restart sonar
  [plaintext]
1
2
3
4
5
6
7
$ pwd /home/hbb/tool/sonar/sonarqube-6.2/bin/linux-x86-64 $ ./sonar.sh restart Stopping SonarQube... SonarQube was not running. Starting SonarQube... Started SonarQube.
  • 启动失败
  [plaintext]
1
2
Starting SonarQube... Failed to start SonarQube.

sonar.log

  [plaintext]
1
2
3
4
5
6
--> 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

edit the /home/hbb/tool/sonar/sonarqube-6.2/conf/wrapper.conf

  [plaintext]
1
2
$ which java /home/hbb/tool/jdk/jdk1.8.0_112/bin/java

then set the content like this

  [plaintext]
1
2
3
4
# Path to JVM executable. By default it must be available in PATH. # Can be an absolute path, for example: #wrapper.java.command=/path/to/my/jdk/bin/java wrapper.java.command=/home/hbb/tool/jdk/jdk1.8.0_112/bin/java

then restart

  [plaintext]
1
2
3
4
5
$ sudo ./sonar.sh restart Stopping SonarQube... SonarQube was not running. Starting SonarQube... Started SonarQube.