1. 程式人生 > >Centos7.5 SonarQube+Artifactory部署

Centos7.5 SonarQube+Artifactory部署

查看 jdbc install conf ner sta conn starting build

一、概述
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

mysql -uroot -p

新建數據庫 sonar

CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci;

新建用戶 sonar 並設置密碼 sonar

CREATE USER ‘sonar‘ IDENTIFIED BY ‘sonar‘;

授權

GRANT ALL ON sonar. TO ‘sonar‘@‘%‘ IDENTIFIED BY ‘sonar‘;
GRANT ALL ON sonar.
TO ‘sonar‘@‘localhost‘ IDENTIFIED BY ‘sonar‘;
FLUSH PRIVILEGES;



sonarqube安裝及配置
1、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 ./

2、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
![](http://i2.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
![](http://i2.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=)
![](http://i2.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的漢化包

兼容列表如下:
![](http://i2.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=)

Centos7.5 SonarQube+Artifactory部署