Reference document: http://blog.csdn.net/kefengwang/article/details/54377055
1. Download: wget https://fossies.org/linux/misc/sonarqube-7.0.zip
2. Placement sonar.properties
## sudo vim /opt/sonarqube-6.2/conf/sonar.properties
sonar.web.javaOpts=-server -Xms256m -Xmx768m -XX:+HeapDumpOnOutOfMemoryError
sonar.jdbc.username=root
sonar.jdbc.password=root
sonar.jdbc.url=jdbc:mysql://127.0.0.1:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false
## The following sets the access URL to http://centos:9000/sonar
sonar.web.host=172.16.27.46
sonar.web.port=7070
sonar.web.context=/sonar
sonar.search.javaAdditionalOpts=-Dbootstrap.system_call_filter=false
3. Install the plugin (note that if the plugin fails during the download process, you need to rm -rf the plugin name first, otherwise the restart will fail)
sudo wget https://github.com/SonarQubeCommunity/sonar-l10n-zh/releases/download/sonar-l10n-zh-plugin-1.13/sonar-l10n-zh-plugin-1.13.jar (汉化版) sudo wget https://github.com/SonarQubeCommunity/sonar-findbugs/releases/download/3.4.4/sonar-findbugs-plugin-3.4.4.jar (findbugs) sudo wget https://github.com/SonarQubeCommunity/sonar-checkstyle/releases/download/2.4/sonar-checkstyle-plugin-2.4.jar (checkstyle) sudo wget https://github.com/SonarQubeCommunity/sonar-pmd/releases/download/2.6/sonar-pmd-plugin-2.6.jar (pmd) sudo wget https://github.com/SonarQubeCommunity/sonar-sonargraph/releases/download/sonar-sonargraph-plugin-3.5/sonar-sonargraph-plugin-3.5.jar (sonargraph)
Restart the service after installing the plugin
./sonar.sh restart
4. Access address:
http://172.16.27.46:7070/sonar admin / admin
Enter: Administration (configuration) / Security (authority) / User (user), find the user admin, and click the "Tokens" column;
In the pop-up interface: enter TokenName="admin", click "Generate", and generate "f041b74aab3959767ae0e8584c632033b6cc9a19"
5. Set external permissions:
token:f041b74aab3959767ae0e8584c632033b6cc9a19
Six. jenkens set the sonar plugin
1. Configure the url of the upgrade site
Open the "Advanced" option of the plugin management, fill in in the upgrade site, then restart
http://mirror.xmission.com/jenkins/updates/update-center.json
2. Download the sonar plugin
3. Set the Sonar plugin in jenkins (System Management / System Settings / Quality Gates - Sonarqube )
Notice:
1. Need to add database
create database sonar;
2. Since es cannot be started under root, we need to change the user to start sonar
Error:
It needs to be started by another user, because the es plugin is required
3. The mysql version is too low
current mysql version
Currently Sonar requires mysql5.6 or above
4.findbugs报错:(Fail to load plugin Findbugs [findbugs] Caused by: java.lang.NoClassDefFoundError: org/sonar/api/web/CodeColorizerFormat)