下載sonarqube-4.5.zip和sonar-runner-dist-2.4.zipmysql
上傳到服務器,解壓linux
unzip sonarqube-4.5.zip
unzip sonar-runner-dist-2.4.zip
設置環境變量sql
export SONAR_RUNNER_HOME=/opt/sonar/sonar-runner-2.4 export PATH=$SONAR_RUNNER_HOME/bin:$PATH
修改配置數據庫
修改sonarqube的配置%SONARQUBE_HOME%/conf/sonar.properties
服務器
# User credentials. # Permissions to create tables, indices and triggers must be granted to JDBC user. # The schema must be created first. sonar.jdbc.username=sonar sonar.jdbc.password=sonar #----- MySQL 5.x sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
修改sonar-runner的配置%SONAR_RUNNER_HOME%/conf/sonar-runner.properties
#----- Default SonarQube server
sonar.host.url=http://localhost:9000ide
#----- PostgreSQL #sonar.jdbc.url=jdbc:postgresql://localhost/sonar #----- MySQL sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8 #----- Global database settings sonar.jdbc.username=sonar sonar.jdbc.password=sonar #----- Default source code encoding sonar.sourceEncoding=UTF-8 #----- Security (when 'sonar.forceAuthentication' is set to 'true') sonar.login=admin sonar.password=admin
建立數據庫,腳本以下:post
create database if not exists sonar character set utf8; CREATE USER 'sonar'@'%' IDENTIFIED BY 'sonar'; CREATE USER 'sonar'@'localhost' IDENTIFIED BY 'sonar'; grant all privileges on sonar.* to 'sonar'@'%' identified by 'sonar'; grant all privileges on sonar.* to 'sonar'@'localhost' identified by 'sonar'; flush privileges;
啓動sonar:url
%SONARQUBE_HOME%/bin/linux-x86-64/sonar.sh
漢化步驟操作系統