本文共 5253 字,大约阅读时间需要 17 分钟。
1:需求文件整理
系统:debian8.6环境:lnmp(参考:)jenkins: jenkins 2.7.2sonarQube:sonarQube5.6sonarscanner:Sonarscanner3.0.3java:jdk82:java的安装配置我已经吧环境需求文件放到了我的'百度网盘'链接: 密码:vrp2下载到本地计算机上传到服务器上面: 通过winscp或者lrzsz上传到服务都可以,根据自己的方式我此处:放到了/data/soft下面通过lrzsz方式root@iZ2zeb1kcfbotalsu02k64Z:/data/soft# apt-get install lrzsz
root@iZ2zeb1kcfbotalsu02k64Z:/data/soft# rz选择自己刚刚下载的文件上传到此目录即可java环境配置root@iZ2zeb1kcfbotalsu02k64Z:/data/soft#tar xf jdk8.tar.gz配置环境变量
root@iZ2zeb1kcfbotalsu02k64Z:/data/soft# vim /etc/profileexport PATH=/usr/local/nginx/sbin:/usr/local/php/bin:/usr/local/mysql/bin:/usr/local/node/bin:/data/soft/jdk8/bin:$PATHroot@iZ2zeb1kcfbotalsu02k64Z:/data/soft# source /etc/profile检测java环境是否安装完毕root@iZ2zeb1kcfbotalsu02k64Z:/data/soft# java -versionjava version "1.8.0_121"Java(TM) SE Runtime Environment (build 1.8.0_121-b13)Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mod3:jenkins安装配置
参考:找到属于自己服务环境的点击进去,按照步骤安装即可4:sonarqube安装配置配置mysql:MySQL [(none)]> create database sonar character set utf8 collate utf8_general_ci;MySQL [(none)]>grant all on sonar.* to 'ops'@'localhost' identified by 'ops12300.';MySQL [(none)]>flush privileges;
解压sonarqube到/usr/local
root@iZ2zeb1kcfbotalsu02k64Z:/data/soft# unzip sonarqube-5.6.6.zip -d /usr/local/配置sonarquberoot@iZ2zeb1kcfbotalsu02k64Z:/usr/local/sonarqube-5.6.6/conf# cd /usr/local/sonarqube-5.6.6/conf/root@iZ2zeb1kcfbotalsu02k64Z:/usr/local/sonarqube-5.6.6/conf# vim sonar.propertiesroot@iZ2zeb1kcfbotalsu02k64Z:/usr/local/sonarqube-5.6.6/conf# cat sonar.properties|grep -v "^#"sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformancesonar.jdbc.username=opssonar.jdbc.password=ops12300.sonar.sourceEncoding=UTF-8sonar.login=adminsonar.projectKey=fangxin:11sonar.projectName=fangxinsonar.projectVersion=1.0sonar.password=admin@1fangxin启动sonarQube
root@iZ2zeb1kcfbotalsu02k64Z:/usr/local/sonarqube-5.6.6# root@iZ2zeb1kcfbotalsu02k64Z:/usr/local/sonarqube-5.6.6# ./bin/linux-x86-64/sonar.sh start日志:logs/sonr.log 访问日志:logs/access.log5:jenkins设置安装sonarQube插件
系统管理->插件管理->可选插件->sonarqube plugin 点击安装5.2:安装配置
JenkinsGlobal Tool Configuration配置sonarqube的网址和token:
系统管理->系统设置->token获取此处的token填入上面的token即可
6:sonarQube安装破解包和php环境此处的php和chine语言都是以插件的形式安装的在search里面搜索sonarphp和chine点击insall,之后在重启sonarQube服务即可7:配置程序sonarscnnerroot@iZ2zeb1kcfbotalsu02k64Z:/usr/local/sonarqube-5.6.6# cd /var/lib/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallationroot@iZ2zeb1kcfbotalsu02k64Z:/var/lib/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation# lsSonarqube_scan2.6 Sonarqube_scan3.0.3 sonarsc3.03root@iZ2zeb1kcfbotalsu02k64Z:/var/lib/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation# vim Sonarqube_scan3.0.3/conf/sonar-sonar-runner.properties sonar-scanner.properties sonar-scanner.properties.backroot@iZ2zeb1kcfbotalsu02k64Z:/var/lib/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation# vim Sonarqube_scan3.0.3/conf/sonar-runner.propertiesroot@iZ2zeb1kcfbotalsu02k64Z:/var/lib/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation# cat Sonarqube_scan3.0.3/conf/sonar-runner.properties#Configure here general information about the environment, such as SonarQube DB details for example#No information about specific project should appear here#----- Default SonarQube server
#sonar.host.url=sonar.host.url=#----- PostgreSQL
#sonar.jdbc.url=jdbc:postgresql://localhost/sonar#----- MySQL
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8#----- Oracle
#sonar.jdbc.url=jdbc:oracle:thin:@localhost/XE#----- Microsoft SQLServer
#sonar.jdbc.url=jdbc:jtds:sqlserver://localhost/sonar;SelectMethod=Cursor#----- Global database settings
#sonar.jdbc.username=sonarsonar.jdbc.username=opssonar.jdbc.password=ops12300.#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=adminsonar.sourceEncoding=UTF-8sonar.projectKey=fangxin:11sonar.projectName=fangxinsonar.projectVersion=1.0sonar.sources=.sonar.language=phproot@iZ2zeb1kcfbotalsu02k64Z:/var/lib/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/Sonarqube_scan3.0.3# cat conf/sonar-scanner.properties#Configure here general information about the environment, such as SonarQube DB details for example#No information about specific project should appear here#----- Default SonarQube server
#sonar.host.url=#----- Default source code encoding
#sonar.sourceEncoding=UTF-8#----- Global database settings (not used for SonarQube 5.2+)
#sonar.jdbc.username=sonar#sonar.jdbc.password=sonar#----- PostgreSQL
#sonar.jdbc.url=jdbc:postgresql://localhost/sonar#----- MySQL
#sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8#----- Oracle
#sonar.jdbc.url=jdbc:oracle:thin:@localhost/XE#----- Microsoft SQLServer
#sonar.jdbc.url=jdbc:jtds:sqlserver://localhost/sonar;SelectMethod=Cursorsonar.sources=/home/qa/erpsonar.projectKey=fangxin:11sonar.projectName=fangxinsonar.projectVersion=1.0sonar.language=php8:代码提交检查
提交检查转载于:https://blog.51cto.com/hsuing/2380786