CentOS7.4安装SonarQube Scanner-代码安全扫描

1.下载压缩包

下载地址:https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.2.0.1227-linux.zip

下载链接:https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.2.0.1227-linux.zip

指令:

wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.2.0.1227-linux.zip

2.解压压缩包

unzip sonar-scanner-cli-3.2.0.1227-linux.zip -d /usr/local

重命名

cd /usr/local

mv sonar-scanner-3.2.0.1227-linux sonar-scanner

3.修改配置

vi /usr/local/sonar-scanner/conf/sonar-scanner.properties

添加以下内容

CentOS7.4安装SonarQube Scanner-代码安全扫描_第1张图片

#----- Default SonarQube server
sonar.host.url=http://10.24.21.46:9000
#----- Default source code encoding
sonar.sourceEncoding=UTF-8
sonar.jdbc.username=sonar
sonar.jdbc.password=sonar
sonar.jdbc.url=jdbc:mysql://10.24.21.46:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance

保存并退出

#配置环境变量 

vi /etc/profile  

在最后添加以下内容

export SONAR_SCANNER_HOME=/usr/local/sonar-scanner
export PATH=${SONAR_SCANNER_HOME}/bin:${PATH}

保存并退出

#生效配置 

source /etc/profile

4.测试

sonar-scanner –h

出现以下内容,则安装成功

CentOS7.4安装SonarQube Scanner-代码安全扫描_第2张图片

你可能感兴趣的:(DevOps,Linux,JAVA基础)