SonarQube是一個用於代碼質量管理的開源平臺,用於管理源代碼的質量經過插件形式 能夠支持包括java,C#,C/C++,PL/SQL,Cobol,JavaScrip,Groovy等等二十幾種編程語言的代碼質量管理與檢測。 ``` #### mysql5.6安裝及配置數據庫 centos自帶的repo是不會自動更新每一個軟件的最新版本,因此沒法經過yum方式安裝MySQL的高級版本。 安裝mysql5姿式是要先安裝帶有可用的mysql5系列社區版資源的rpm包 wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm yum -y install mysql-community-release-el7-5.noarch.rpm 查看當前可用的mysql安裝資源 yum list yum repolist enabled | grep "mysql.*-community.*" mysql-connectors-community/x86_64 MySQL Connectors Community 65 mysql-tools-community/x86_64 MySQL Tools Community 69 mysql56-community/x86_64 MySQL 5.6 Community Server 412 使用yum的方式安裝MySQL yum -y install mysql-community-server 啓動mysql並設置開機啓動 systemctl enable mysqld systemctl start mysqld
CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci;java
CREATE USER 'sonar' IDENTIFIED BY 'sonar';mysql
GRANT ALL ON sonar. TO 'sonar'@'%' IDENTIFIED BY 'sonar';
GRANT ALL ON sonar. TO 'sonar'@'localhost' IDENTIFIED BY 'sonar';
FLUSH PRIVILEGES;linux
sonarqube安裝及配置 一、JDK安裝 mdkir /app/tools -p tar -xvf jdk-8u181-linux-x64.tar.gz chown -R root.root jdk1.8.0_181 cd /app/ mkdir jdk cd jdk mv /app/tools/jdk1.8.0_181 ./ 二、JDK配置 vim /etc/profile export JAVA_HOME=/app/jdk/jdk1.8.0_181 export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export PATH=$PATH:$JAVA_HOME/bin source /etc/profile [root@qas-sonarqube-artifactory jdk1.8.0_181]# java -version java version "1.8.0_181" Java(TM) SE Runtime Environment (build 1.8.0_181-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode) [root@qas-sonarqube-artifactory jdk1.8.0_181]# which java /app/jdk/jdk1.8.0_181/bin/java useradd -d /app/sonarqube -m sonarqube;echo "sonarqube" | passwd --stdin sonarqube unzip sonarqube-6.7.5.zip -d /app/sonarqube chown -R sonarqube.sonarqube * grep -n ^[a-Z] /app/sonarqube/sonarqube-6.7.5/conf/sonar.properties 16:sonar.jdbc.username=sonar 17:sonar.jdbc.password=sonar 26:sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false su - sonarqube /app/sonarqube/sonarqube-6.7.5/bin/linux-x86-64/sonar.sh start Starting SonarQube... Started SonarQube. http://172.16.8.253:9000 ![](https://s1.51cto.com/images/blog/201810/21/23b4634dee73e4adf72578eb063a6d38.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=) 默認用戶:admin 密碼:admin ![](https://s1.51cto.com/images/blog/201810/21/bab7d4930d0b37e8e0b08d26ea4cc425.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=) ![](https://s1.51cto.com/images/blog/201810/21/fdde9754087219fa7672e2bd537d4048.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=) SonarQube的漢化包 兼容列表以下: ![](https://s1.51cto.com/images/blog/201810/21/2bceefd7d9250d250420afc60eb74d8d.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)