Sonar6.7.1安装

1.下载安装包

从sonar的官方网站下载最新的sonar版本:https://www.sonarqube.org/downloads/
下载一个名字为sonarqube-6.7.1的zip压缩包,解压缩到安装目录:

unzip sonarqube-6.7.1.zip

2.启动sonar

进入安装目录下的sonarqube-6.7.1/bin/linux-x86-64目录,执行启动脚本:

./sonar.sh start

3.mysql数据库设置

1.在 MySQL 中创建 sonar 数据库

CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci; 
grant all privileges on sonar.* to 'sonar'@'%' identified by 'sonar'; 
GRANT ALL ON sonar.* TO ‘sonar’@’localhost’ IDENTIFIED BY ‘sonar’;
flush privileges;

2.将 MySQL 的驱动文件(如mysql-connector-java-5.1.44-bin.jar)拷贝到 sonarqube-6.7.1/extensions/jdbc-driver/mysql 目录

3.修改 sonarqube-6.7.1\conf\sonar.properties 文件,用 # 注释原来 Derby 的配置项,并打开 MySQL 数据库的配置项:

# Comment the following lines to deactivate the default embedded database.
#sonar.jdbc.url: jdbc:derby://localhost:1527/sonar;create=true
#sonar.jdbc.driverClassName: org.apache.derby.jdbc.ClientDriver
#sonar.jdbc.validationQuery: values(1)

~~~~~~~~~~~~~~~省略部分~~~~~~~~~~~~~~~~~~
# The schema must be created first.
sonar.jdbc.username=sonar
sonar.jdbc.password=sonar

#----- MySQL 5.x/6.x
# Comment the embedded database and uncomment the following 
#properties to use MySQL. The validation query is optional.
        sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar
useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false
#sonar.jdbc.validationQuery: select 1
sonar.web.host=0.0.0.0
# Web context. When set, it must start with forward slash (for example /sonarqube).
# The default value is root context (empty value).
sonar.web.context=/
# TCP port for incoming HTTP connections. Default value is 9000.
sonar.web.port=9000

4.重启 Sonar。

你可能感兴趣的:(jenkins)