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. caffe运行错误: im2col.cu:61] Check failed: error == cudaSuccess (8 vs. 0) invalid device function

    错误: im2col.cu:61] Check failed: error == cudaSuccess (8 vs. 0)  invalid device function 原因:由于Makefil ...

  2. [代码]--python爬虫联系--爬取成语

    闲来无事,玩了个成语接龙,于是就想用python爬取下成语网站上的成语,直接上代码: #coding=utf-8 import requests from bs4 import BeautifulSo ...

  3. BZOJ3237 AHOI2013连通图(线段树分治+并查集)

    把查询看做是在一条时间轴上.那么每条边都有几段存在时间.于是线段树分治就好了. 然而在bzoj上t掉了,不知道是常数大了还是写挂了. 以及brk不知道是啥做数组名过不了编译. #include< ...

  4. Uva821-Floyd

    计算所有页面的平均距离. 用floyd求距离,再求平均 #include <algorithm> #include <cstring> #include <ctype.h ...

  5. ubuntu 16.04 samba服务搭建

    一:安装 1. sudo apt-get install samba 有询问Yes的地方Yes就行. 无法安装samba 执行 sudo apt-get update 2.等待安装完成,进入配置文件目 ...

  6. Django实现websocket完成实时通讯,聊天室,在线客服等

    一 什么是Websocket WebSocket是一种在单个TCP连接上进行全双工通信的协议 WebSocket使得客户端和服务器之间的数据交换变得更加简单,允许服务端主动向客户端推送数据.在WebS ...

  7. [luogu2590][bzoj1036][ZJOI2008]树的统计

    题目描述 一棵树上有n个节点,编号分别为1到n,每个节点都有一个权值w.我们将以下面的形式来要求你对这棵树完成 一些操作: I. CHANGE u t : 把结点u的权值改为t II. QMAX u ...

  8. if语句实例

    if 单分支#!/bin/bashRATE=`df -hT | grep "/boot" | awk '{print $6}' | cut -d "%" -f1 ...

  9. 隐藏技能go:linkname

    来源:https://blog.csdn.net/lastsweetop/article/details/78830772 什么是go:linkname 指令的格式如下: //go:linkname ...

  10. Solr各个版本重大变化之安装方式【请别违背规律】

    这里主要讲安装方式的变化 4.x~5.x的变化 这是4.x的安装方式,大家都熟知,在我看来未免繁琐了一点. 或许官方也感觉繁琐了,于是5.x有个最大的改变.↓ 现在Solr是一个独立的服务器 什么叫S ...