1.下载sonar
https://www.sonarqube.org/#downloads

2.配置JDK1.8

3.centOS默认mysql版本为mariaDB
直接安装yum install mysql,据说可以替换mariaDB的版本

sonar自带数据库,但是会被提示

Embedded database should be used for evaluation purpose only
The embedded database will not scale, it will not support upgrading to newer versions of SonarQube, and there is no support for migrating your data out of it into a different database engine.

所以还是使用mysql比较好
这里要注意的是sonar不支持mysql5.5及以下版本

3.1升级mysql,使用rpm方式
删除原有的mariaDB
yum remove mysql mysql-*
查看已安装的软件:rpm -qa¦grep mysql
rpm方式
找到当前最新版本https://dev.mysql.com/downloads/mysql/
下载mysql
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar
解压
tar -xvf mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar 
依次执行(几个包有依赖关系,所以执行有先后)下面命令安装
[root@centos-linux ~]# rpm -ivh mysql-community-common-5.7.18-1.el7.x86_64.rpm 
[root@centos-linux ~]# rpm -ivh mysql-community-libs-5.7.18-1.el7.x86_64.rpm
[root@centos-linux ~]# rpm -ivh mysql-community-client-5.7.18-1.el7.x86_64.rpm 
[root@centos-linux ~]# rpm -ivh mysql-community-server-5.7.18-1.el7.x86_64.rpm

3.2升级mysql,使用yum方式
安装mysql的源
yum install http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
Yum install -y mysql-community-server
systemctl start mysqld.service

4.mysql 修改root账户密码
mysql5.6以后的版本安全机制增强了,临时密码只允许登录,不允许操作数据库,所以必须更改。

4.1先停止mysql服务

service mysqld stop

4.2先修改配置文件

vi /etc/my.cnf

# Disabling symbolic-links is recommended to prevent assorted security risks
skip-grant-tables #添加这句话,这时候登入mysql就不需要密码
symbolic-links=0

4.3.空密码登录mysql:

mysql -u root -p #输入命令回车进入,出现输入密码提示直接回车
4.4.设置mysql密码:

mysql> set password for root@localhost = password('123456');
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
mysql> flush privileges; #更新权限
Query OK, 0 rows affected (0.00 sec)
mysql> set password for root@localhost = password('123456'); or update user set authentication_string=PASSWORD("123456") where user="root";
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql>flush privileges; #更新权限
mysql>quit; #退出
4.5 停止mysql服务, 恢复mysql配置

service mysqld stop 
4.6 vim /etc/my.cnf #修改配置文件
# Disabling symbolic-links is recommended to prevent assorted security risks
# skip-grant-tables # 注释掉这句话
symbolic-links=0
4.7启动mysql服务

service mysqld start

4.8 输入新密码登录
mysql -uroot -p 
4.9.设置mysql开机自启:

systemctl enable mysqld

5.mysql 添加sonar用户

mysql> CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci; 
mysql> CREATE USER 'sonar' IDENTIFIED BY 'sonar';
mysql> GRANT ALL ON sonar.* TO 'sonar'@'%' IDENTIFIED BY 'sonar';
mysql> GRANT ALL ON sonar.* TO 'sonar'@'localhost' IDENTIFIED BY 'sonar';
mysql> FLUSH PRIVILEGES;

这里有个问题,新密码设置的时候如果设置的过于简单会报错:所以sonar这个密码应该是用不了了。根据需要自己修改吧

运行后提示Table ‘performance_schema.session_variables’ doesn’t exist
解决的方法是:mysql_upgrade -u root -p --force

6.解压sonar,这里用6.7版本

7.修改配置文件

vi /usr/local/sonarqube/conf/sonar.properties

取消如下选项的#注释并修改内容

sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance

sonar.jdbc.username=sonar

sonar.jdbc.password=sonar

sonar.web.host=0.0.0.0

sonar.web.context=

sonar.web.port=9000

3.运行sonarqube目录下的./bin/linux-x86-64/sonar.sh start

sonar6.7版本已经不允许root用户直接登录了,所以登陆前要切换到其他linux用户

切换的用户要注意是否拥有该目录的权限

8.观察启动日志
tail -200f ./logs/sonar.log

9.打开防火墙的9000端口
firewall-cmd --permanent --add-port=9000/tcp
firewall-cmd --reload

10.访问sonar
http://localhost:9000/
可以看到页面了

11.登录
默认用户名admin,密码admin

12.安装中文补丁包
https://github.com/SonarQubeCommunity/sonar-l10n-zh

12.1下载sonar-l10n-zh-plugin-1.19.jar

12.2.将jar文件复制到Sonarqube主目录extensions/plugins文件夹内
12.3.重启Sonarqube服务

13.安装SonarQube Scanner

13.1.下载SonarQube Scanner

https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner

13.2.解压

unzip sonar-scanner-cli-3.0.3.778-linux.zip

13.3.修改配置文件

修改conf/sonar-scanner.properties

如果没有和sonarqube安装在同一台服务器上,就需要修改,否则默认就可以了

sonar.host.url=http://localhost:9000

sonarqube6.7安装的更多相关文章

  1. centos7安装sonarqube6.7 代码质量管理平台

    应用介绍:SonarQube是一个用于代码质量管理的开源平台,用于管理源代码的质量通过插件形式:    可以支持包括java,C#,C/C++,PL/SQL,Cobol,JavaScrip,Groov ...

  2. Centos6.5上安装sonarqube6.7.6

    Centos6.5已经装备好,可以联网 sonarqube6.7.6下载地址:https://www.sonarqube.org/downloads/ 步骤: 安装MySQL5.7 MySQL详细的安 ...

  3. CentOS6.8安装配置sonarqube6.4

    下载最新版本的sonar(现在改名叫sonarqube) https://www.sonarqube.org/downloads/ 我下载的版本是Sonarqube6.4        1 使用前需要 ...

  4. SonarQube6.7.4安装部署

    1.准备工作 https://www.sonarqube.org Sonar 是一个用于代码质量管理的开放平台.通过插件机制,Sonar 可以集成不同的测试工具,代码分析工具,以及持续集成工具.比如p ...

  5. Linux安装sonarQube

    安装sonarQube之前,需要先安装JDK和mysql 服务器/home/azrlnx04/下创建三个文件夹,/java ./mysql. /sonar 一:安装JDK (1)打开http://ww ...

  6. Linux下SonarQube代码质量平台的安装和使用方法

    Sonar简介: Sonar是一个用于代码质量管理的开源平台,用于管理源代码的质量,可以从七个维度检测代码质量 通过插件形式,可以支持包括java,C#,C/C++,PL/SQL,Cobol,Java ...

  7. sonarqube6.7部署文档

    应用介绍:sonarqube是一个用于代码质量管理的开源平台,用于管理源代码的质量通过插件形式:可以支持包括Java.C#/C++.PL/SQL.Cobol.javascrip.Groovy等等二十几 ...

  8. SonarQube安装文档

    1.SonarQube 1.1 SonarQube介绍 SonarQube是管理代码质量一个开放平台,可以快速的定位代码中潜在的或者明显的错误. SonarQube是否可以使用自定义规则由开发人员的开 ...

  9. sonar安装

    ##jdk不要用yum下载的 一.下载sonar源码 cd /usr/local/src wget https://sonarsource.bintray.com/Distribution/sonar ...

随机推荐

  1. git-stash用法小结

    [时间:2016-10] [状态:Open] [关键词:git,版本控制,版本管理,stash,git储藏] 缘起 今天在看一个bug,之前一个分支的版本是正常的,在新的分支上上加了很多日志没找到原因 ...

  2. sakila数据库及其他数据库实例文件

    下载地址: https://dev.mysql.com/doc/index-other.html Other MySQL Documentation This page provides additi ...

  3. 自学Zabbix之路15.3 Zabbix数据库表结构简单解析-Triggers表、Applications表、 Mapplings表

    点击返回:自学Zabbix之路 点击返回:自学Zabbix4.0之路 点击返回:自学zabbix集锦 自学Zabbix之路15.3 Zabbix数据库表结构简单解析-Triggers表.Applica ...

  4. 【Luogu4931】情侣?给我烧了! 加强版(组合计数)

    [Luogu4931]情侣?给我烧了! 加强版(组合计数) 题面 洛谷 题解 戳这里 忽然发现我自己推的方法是做这题的,也许后面写的那个才是做原题的QwQ. #include<iostream& ...

  5. 【BZOJ4813】[CQOI2017]小Q的棋盘(贪心)

    [BZOJ4813][CQOI2017]小Q的棋盘(贪心) 题面 BZOJ 洛谷 题解 果然是老年选手了,这种题都不会做了.... 先想想一个点如果被访问过只有两种情况,第一种是进入了这个点所在的子树 ...

  6. emwin 之变量定义位置

    @2018-08-13 小记 本意是想在回调函数中定义一变量暂存下拉框操作前的的设定值,与后期更改的设定值作比较后更新操作,但结果失败了 分析后,此变量定义为局部变量,emwin回调函数又是事件触发型 ...

  7. Surrounded Regions - LeetCode

    目录 题目链接 注意点 解法 小结 题目链接 https://leetcode.com/problems/surrounded-regions/ 注意点 边缘不算包围'O' 解法 解法一:dfs.找处 ...

  8. 洛谷 P1120 小木棍 [数据加强版]解题报告

    P1120 小木棍 [数据加强版] 题目描述 乔治有一些同样长的小木棍,他把这些木棍随意砍成几段,直到每段的长都不超过50. 现在,他想把小木棍拼接成原来的样子,但是却忘记了自己开始时有多少根木棍和它 ...

  9. WorkFlow基础实战

    WorkFlow使用笔记---- 状态机工作流的使用: 1.首先,项目的目标框架要选择.Net4.5版本,才有状态机工作流. 2.新建“活动”项,先从工具栏拖出一个StateMachine,然后添加其 ...

  10. Python常用内置模块之xml模块

    xml即可扩展标记语言,它可以用来标记数据.定义数据类型,是一种允许用户对自己的标记语言进行定义的源语言.从结构上,很像HTML超文本标记语言.但他们被设计的目的是不同的,超文本标记语言被设计用来显示 ...