1: Requirements File collation
System: debian8.6
Environment: LNMP (Reference: lhttps://blog.linuxeye.cn/31.html)
Jenkins:jenkins 2.7.2
sonarqube:sonarqube5.6
sonarscanner:sonarscanner3.0.3
Java:jdk8
Installation configuration for 2:java
I already have. Environmental requirements file put in my ' Baidu network disk ' link: http://pan.baidu.com/s/1mi40gNe password: VRP2
Download to local computer
Upload to the server: by WinSCP or Lrzsz upload to the service can, according to their own way
I'm here: put it under the/data/soft by Lrzsz Way
[Email protected]:/data/soft# apt-get Install Lrzsz
[Email protected]:/data/soft# RZ
Select the file you just downloaded to upload to this directory
Java Environment Configuration
[Email Protected]:/data/soft#tar XF jdk8.tar.gz
Configure environment Variables
[email protected]:/data/soft# vim/etc/profile
export path=/ Usr/local/nginx/sbin:/usr/local/php/bin:/usr/local/mysql/bin:/usr/local/node/bin:/data/soft/jdk8/bin: $PATH
[email protected]:/data/soft# source
Detects if the Java environment is installed
[email protected]:/data/soft# java-version
java 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 mod
3:jenkins installation Configuration
Reference: http://pkg.jenkins-ci.org/
Find the click of your own service environment, follow the steps to install
4:sonarqube installation configuration
Configure 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;
Unzip Sonarqube to/usr/local
[Email protected]:/data/soft# unzip sonarqube-5.6.6.zip-d/usr/local/
Configure Sonarqube
[Email protected]:/usr/local/sonarqube-5.6.6/conf# cd/usr/local/sonarqube-5.6.6/conf/
[Email protected]:/usr/local/sonarqube-5.6.6/conf# vim sonar.properties
[Email protected]:/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=maxperformance
Sonar.jdbc.username=ops
sonar.jdbc.password=ops12300.
Sonar.sourceencoding=utf-8
Sonar.login=admin
Sonar.projectkey=fangxin:11
Sonar.projectname=fangxin
sonar.projectversion=1.0
[Email protected]
Start Sonarqube
[Email protected]:/usr/local/sonarqube-5.6.6#
[Email protected]:/usr/local/sonarqube-5.6.6#./bin/linux-x86-64/sonar.sh start
LOG: Logs/sonr.log
Access log: Logs/access.log
5:jenkins Setup Install Sonarqube plugin
System Management - plug-in management, optional plug-in->sonarqube plugin click to install
5.2: Installation Configuration
Jenkinsglobal Tool Configuration
Configure the Sonarqube URL and token:
System Management, System settings
Token acquisition
The tokens here are filled in with the tokens above.
6:sonarqube install cracked packages and PHP environment
The PHP and Chine languages are installed as plug-ins here.
Search for sonarphp and Chine Click Insall, then restart the Sonarqube service
7: Configuration Program Sonarscnner
[Email protected]:/usr/local/sonarqube-5.6.6# cd/var/lib/jenkins/tools/ Hudson.plugins.sonar.SonarRunnerInstallation
[Email protected]:/var/lib/jenkins/tools/hudson.plugins.sonar.sonarrunnerinstallation# ls
sonarqube_scan2.6 sonarqube_scan3.0.3 sonarsc3.03
[Email protected]:/var/lib/jenkins/tools/hudson.plugins.sonar.sonarrunnerinstallation# vim Sonarqube_scan3.0.3/ conf/sonar-
Sonar-runner.properties sonar-scanner.properties Sonar-scanner.properties.back
[Email protected]:/var/lib/jenkins/tools/hudson.plugins.sonar.sonarrunnerinstallation# vim Sonarqube_scan3.0.3/ Conf/[email protected]:/var/lib/jenkins/tools/hudson.plugins.sonar.sonarrunnerinstallation# Cat Sonarqube_ Scan3.0.3/conf/sonar-runner.properties
#Configure Here general information on the environment, such as SonarQube DB details for example
#No information about specific project should appear here
#-----Default SonarQube Server
#sonar. host.url=http://localhost:9000
sonar.host.url=http://192.168.1.10:9000
#-----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 SQL Server
#sonar. Jdbc.url=jdbc:jtds:sqlserver://localhost/sonar; Selectmethod=cursor
#-----Global Database Settings
#sonar. Jdbc.username=sonar
Sonar.jdbc.username=ops
sonar.jdbc.password=ops12300.
#sonar. Jdbc.password=sonar
#-----Default Source Code encoding
Sonar.sourceencoding=utf-8
#-----Security (when ' sonar.forceauthentication ' are set to ' true ')
#sonar. login=admin
#sonar. password=admin
Sonar.sourceencoding=utf-8
Sonar.projectkey=fangxin:11
Sonar.projectname=fangxin
sonar.projectversion=1.0
Sonar.sources=.
sonar.language=php
[Email protected]:/var/lib/jenkins/tools/hudson.plugins.sonar.sonarrunnerinstallation/sonarqube_scan3.0.3# Cat Conf/sonar-scanner.properties
#Configure Here general information on the environment, such as SonarQube DB details for example
#No information about specific project should appear here
#-----Default SonarQube Server
#sonar. host.url=http://localhost:9000
#-----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 SQL Server
#sonar. Jdbc.url=jdbc:jtds:sqlserver://localhost/sonar; Selectmethod=cursor
Sonar.sources=/home/qa/erp
Sonar.projectkey=fangxin:11
Sonar.projectname=fangxin
sonar.projectversion=1.0
sonar.language=php
8: Code submission Check
Submit a check
Continuous build jenkins+sonar5.6 automatically review PHP environment