Sonarqube 代码质量管理平台搭建

Sonarqube官网
[http://www.sonarqube.org/]
获取安装包,当前为sonarqube-5.3.zip

请先看支持安装环境:
[http://docs.sonarqube.org/display/SONAR/Requirements]

Sonar介绍
Sonar (SonarQube)是一个开源平台,用于管理源代码的质量。Sonar 不只是一个质量数据报告工具,更是代码质量管理平台。支持的语言包括:Java、PHP、C#、C、Cobol、PL/SQL、Flex 等。

Sonar数据库创建

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;

Sonar数据库配置
$SONAR_HOME/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
sonar.jdbc.driverClassName=com.mysql.jdbc.Driver

Sonar端口配置
$SONAR_HOME/conf/sonar.properties

sonar.web.port=9999

Sonar JDK配置
$SONAR_HOME/conf/wrapper.conf

wrapper.java.command=/opt/test/lixr/jdk1.8.0_45/bin/java```

Sonar 启动
$SONAR_HOME/bin/linux-x86-64/sonar.sh start

Sonar自启动
vi /etc/init.d/sonar

!/bin/sh

rc file for SonarQube

chkconfig: 345 96 10

description: SonarQube system (www.sonarsource.org)

BEGIN INIT INFO

Provides: sonar

Required-Start: $network

Required-Stop: $network

Default-Start: 3 4 5

Default-Stop: 0 1 2 6

Short-Description: SonarQube system (www.sonarsource.org)

Description: SonarQube system (www.sonarsource.org)

END INIT INFO

/usr/bin/sonar $*

sudo ln -s $SONAR_HOME/bin/linux-x86-64/sonar.sh /usr/bin/sonar
sudo chmod 755 /etc/init.d/sonar
sudo chkconfig --add sonar

查看启动情况
$SONAR_HOME/logs/sonar.log
会自动创建数据库所需数据

Sonar 访问
http://192.168.220.126:9999/

你可能感兴趣的:(Sonarqube 代码质量管理平台搭建)