SonarQube4.5.7的安装
环境:jdk1.7 linux
1.下载SonarQube4.5.7
https://www.sonarqube.org/downloads/
下载后解压到/usr/local/
修改/usr/local/sonarqube4.5.7/conf/sonar.properties
sonar.web.host=localhost
# Web context. When set, it must start with forward slash (for example /sonarqube).
# The default value is root context (empty value).
sonar.web.context=/sonar
# TCP port for incoming HTTP connections. Disabled when value is -1.
sonar.web.port=9000
2.下载中文插件
cd /usr/local/sonarqube4.5.7/extensions/plugins/
重启sh sonar.sh restart
3.安装sonar-runner-dist-2.4
解压到/usr/local
修改/usr/local/sonar-runner-2.4/conf/sonar-runner.properties
#----- Default SonarQube server sonar.host.url=http://localhost:9000/sonar #----- PostgreSQL #sonar.jdbc.url=jdbc:postgresql://localhost/sonar #----- MySQL sonar.jdbc.url=jdbc:mysql://10.10.13.7: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=devuser sonar.jdbc.password=devuser #----- Default source code encoding #sonar.sourceEncoding=UTF-8 #----- Security (when 'sonar.forceAuthentication' is set to 'true') sonar.login=admin sonar.password=admin
4.为sonar创建数据库及用户账号密码
如果已经有数据库了创建一个sonar就可以了,没有得自行百度安装创建
5.添加环境配置
vim /etc/profile
SONAR_HOME=/usr/local/sonarqube-4.5.7 SONAR_RUNNER_HOME=/usr/local/sonar-runner-2.4 JAVA_HOME=/usr/java/jdk1.7.0_17 PATH=$PATH:$JAVA_HOME/bin:%SONAR_RUNNER_HOME%\bin:%SONAR_HOME%\bin export PATH
6.启动sonarqube4.5.7服务
cd /usr/local/sonarqube4.5.7/bin/linux-x86-64
sh sonar.sh start