#vi sonar.properties
sonar.jdbc.username:                       sonar
sonar.jdbc.password:                       sonar
sonar.jdbc.url:                            jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true
# Optional properties
sonar.jdbc.driverClassName:                com.mysql.jdbc.Driver

  修改sonar-runner的配置文件
  切换至sonar-runner的安装目录下,修改sonar-runner.properties
  根据实际使用数据库情况取消相应注释

#Configure here general information about 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
#----- 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 SQLServer
#sonar.jdbc.url=jdbc:jtds:sqlserver://localhost/sonar;SelectMethod=Cursor
#----- Global database settings
sonar.jdbc.username=sonar
sonar.jdbc.password=sonar
#----- Default source code encoding
sonar.sourceEncoding=UTF-8
#----- Security (when 'sonar.forceAuthentication' is set to 'true')
sonar.login=admin
sonar.password=admin

  3.添加数据库驱动
  除了Oracle数据库外,其它数据库驱动都默认已经提供了,且这些已添加的驱动是sonar支持的,因此不需要修改
  如果是Oracle数据库,需要复制JDBC驱动至<install_directory>/extensions/jdbc-driver/oracle目录
  4.启动服务
  目录切换至sonar的<install_directory>/bin/linux-x86-64/目录,启动服务
  #./sonar.sh start   启动服务
  #./sonar.sh stop    停止服务
  #./sonar.sh restart 重启服务
  至此,sonar安装好了
  访问http:\localhost:9000即可
  5.sonar中文补丁包安装
  中文包安装
  安装中文补丁包可以通过访问http:\localhost:9000,打开sonar后,进入更新中心安装
  或者下载中文补丁包后,放到SONARQUBE_HOME/extensions/plugins目录,然后重启SonarQube服务