Sonar安装步骤

  1. 下载sonarqube-4.5.zipsonar-runner-dist-2.4.zipmysql

  2. 上传到服务器,解压linux

    • unzip sonarqube-4.5.zip
    • unzip sonar-runner-dist-2.4.zip
  3. 设置环境变量sql

    export SONAR_RUNNER_HOME=/opt/sonar/sonar-runner-2.4
    export PATH=$SONAR_RUNNER_HOME/bin:$PATH
  4. 修改配置数据库

    • 修改sonarqube的配置%SONARQUBE_HOME%/conf/sonar.properties服务器

      # User credentials.
      # Permissions to create tables, indices and triggers must be granted to JDBC user.
      # The schema must be created first.
      sonar.jdbc.username=sonar
      sonar.jdbc.password=sonar
      #----- MySQL 5.x
      sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
    • 修改sonar-runner的配置%SONAR_RUNNER_HOME%/conf/sonar-runner.properties
      #----- Default SonarQube server
      sonar.host.url=http://localhost:9000ide

      #----- PostgreSQL
      #sonar.jdbc.url=jdbc:postgresql://localhost/sonar
      
      #----- MySQL
      sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8
      #----- 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
  5. 建立数据库,脚本以下:post

    create database if not exists sonar character set utf8;
    CREATE USER 'sonar'@'%' IDENTIFIED BY 'sonar';
    CREATE USER 'sonar'@'localhost' IDENTIFIED BY 'sonar';
    grant all privileges on sonar.* to 'sonar'@'%' identified by 'sonar';
    grant all privileges on sonar.* to 'sonar'@'localhost' identified by 'sonar';
    flush privileges;
  6. 启动sonar:url

    • %SONARQUBE_HOME%/bin/linux-x86-64/sonar.sh
    • 请将%SONARQUBE_HOME%替换成sonar安装目录
    • linux-x86-64视具体操做系统而定
  7. 汉化步骤操作系统

相关文章
相关标签/搜索