前言
    一款不错的代码质量管理工具Sonar
前期准备
    软件下载
    硬件环境(在官方参考文档有提出硬件规格,如下只是测试环境)
            磁盘 ->16G
            内存 ->2G
            CPU -> 2core
    软件环境
            OS -> Red Hat Enterprise 6.5
            DB -> Mysql 5.7
            Sonar -> SonarQube 6.7.1 (LTS *)
            IP -> 192.168.1.59
            Host -> t-xi-sonar01
系统初始化
        关闭selinux和防火墙
           [root@t-xi-sonar01 ~]# vi /etc/selinux/config
               SELINUX=disabled
           [root@t-xi-sonar01 ~]# chkconfig  iptables off&&chkconfig  ip6tables off&&service iptables stop&&service ip6tables stop
      [root@t-xi-sonar01 ~]# vi /etc/hosts

            192.168.1.59 t-xi-sonar01
        配置Yum源,我这里配置了web站点,所以指定了http地址.
          [root@t-xi-sonar01 ~]# cat /etc/yum.repos.d/rhel-source.repo
[rhel-source]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
enabled=1
gpgcheck=0
 
  也可以使用ios镜像进行配置yum源
 [root@t-xi-orc01 ~]# mount -o loop /u01/rhel-server-6.5-x86_64-dvd.iso /u01/http/redhat6.5
 [root@t-xi-orc01 ~]# cat /etc/yum.repos.d/rhel-source.repo
 [Server]
 name=Red Hat Enterprise Linux $releasever - $basearch - Server
 baseurl=file:///u01/http/redhat6.5/Server
 enabled=1
 gpgcheck=0
 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
        
        系统内核优化(参考文档中有)

 [root@t-xi-sonar01 ~]# vi /etc/sysctl.conf
#add sonar
vm.max_map_count =
fs.file-max = [root@t-xi-sonar01 ~]# vi /etc/security/limits.conf
#add sonar
sonarqube - nofile
sonarqube - nproc sysctl -w vm.max_map_count=
sysctl -w fs.file-max=
ulimit -n
ulimit -u

安装Mysql数据库

      首先移除原有mysql-libs-5.1.71-1.el6.x86_64包,但它依赖postfix。
      [root@t-xi-sonar01 ~]# yum remove postfix
      [root@t-xi-sonar01 ~]# rpm -e mysql-libs-5.1.71-1.el6.x86_64
      安装下载的Mysql 5.7
      [root@t-xi-sonar01 ~]#
        rpm -ivh mysql-community-client-5.7.20-1.el6.x86_64.rpm
        rpm -ivh mysql-community-common-5.7.20-1.el6.x86_64.rpm
        rpm -ivh mysql-community-devel-5.7.20-1.el6.x86_64.rpm
        rpm -ivh mysql-community-embedded-5.7.20-1.el6.x86_64.rpm
        rpm -ivh mysql-community-embedded-devel-5.7.20-1.el6.x86_64.rpm
        rpm -ivh mysql-community-libs-5.7.20-1.el6.x86_64.rpm
        rpm -ivh mysql-community-libs-compat-5.7.20-1.el6.x86_64.rpm
        rpm -ivh mysql-community-server-5.7.20-1.el6.x86_64.rpm

  注意将原来移除的包重新安装
        yum install postfix  crontabs
            优化Mysql数据库参数     
[root@t-xi-sonar01 ~]# vi /etc/my.cnf
query_cache_size=8M
innodb_buffer_pool_size=1152M
innodb_log_file_size=256M
innodb_log_buffer_size=4M
innodb_flush_log_at_trx_commit=
innodb_thread_concurrency=
innodb_flush_method=O_DIRECT
transaction-isolation=READ-COMMITTED
thread_cache_size=
slow_query_log=on
slow-query-log-file=mysqld-slow.log
long_query_time=
explicit_defaults_for_timestamp=true
skip-character-set-client-handshake
collation-server=utf8_unicode_ci
character-set-server=utf8

  启动数据库,此时数据库会生成临时密码

            [root@t-xi-sonar01 ~]# service mysqld start
           启动时要随时关注mysql数据库产生的日志记录
            [root@t-xi-sonar01 ~]# tail -f  /var/log/mysqld.log
           查看临时密码
            [root@t-xi-sonar01 ~]#grep 'temporary password' /var/log/mysqld.log
                2017-12-26T10:37:57.842981Z 1 [Note] A temporary password is generated for root@localhost: cSj&aPfkS60w
            登陆并且更新密码
            [root@t-xi-sonar01 ~]#mysql -uroot -p
            mysql>ALTER USER 'root'@'localhost' IDENTIFIED BY '******';
            mysql>FLUSH PRIVILEGES;
            将mysql数据库设定为自启动
            [root@t-xi-sonar01 ~]# chkconfig mysqld on
            
    创建Sonar账户和数据库
            [root@t-xi-sonar01 ~]#useradd sonar
            [root@t-xi-sonar01 ~]#passwrd sonar
 
            [root@t-xi-sonar01 ~]#mysql -uroot -p
            mysql>create user 'sonar'@'localhost' identified by 'sonar';
            mysql>CREATE DATABASE sonar
                          DEFAULT CHARACTER SET utf8
                          DEFAULT COLLATE utf8_general_ci;
            mysql>GRANT ALL PRIVILEGES ON sonar.* TO 'sonar'@'localhost';
            mysql>FLUSH PRIVILEGES;
 
    安装Sonar软件
            [root@t-xi-sonar01 ~]# unzip sonarqube-6.7.1.zip
            [root@t-xi-sonar01 ~]# mv sonarqube-6.7.1 /etc/sonarqube
            [root@t-xi-sonar01 ~]# chown -R sonar.sonar /etc/sonarqube
                注意:sonarqube后面启动 ./sonar.sh start时不能使用root账户,es.log报错信息
                 2017.12.27 13:59:30 ERROR es[][o.e.b.Bootstrap] Exception java.lang.RuntimeException: can not run elasticsearch as root
  切换到Sonar账户
            [sonar@t-xi-sonar01 sonarqube]$
            [root@t-xi-sonar01 sonarqube]# su - sonar
            [sonar@t-xi-sonar01 ~]$ cd /etc/sonarqube/
        查看/etc/sonarqube目录树(主要的三个,可以查看参考文档)

bin ->软件运行目录
conf -> 软件配置目录
COPYING
data
elasticsearch
extensions
lib
logs ->软件运行日志目录
temp
web

配置软件参数

                    [sonar@t-xi-sonar01 sonarqube]$ cat conf/sonar.properties|grep -v '^#'|grep -v '^$'|grep -v '=$'
      

sonar.jdbc.username=sonar
sonar.jdbc.password=sonar
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false
                            注意Sonar Web访问默认地址为9000,账户admin/admin
 
                     启动Sonar软件 
                               [sonar@t-xi-sonar01 sonarqube]$ bin/linux-x86-64/sonar.sh start
                               注意查看logs/es.log 和logs/sonar.log两个日志文件
         [sonar@t-xi-sonar01 sonarqube]$ less logs/es.log
                         [sonar@t-xi-sonar01 sonarqube]$ less logs/sonar.log
            访问Sonar
                http://192.168.1.59:9000
    

    

    

                
  前期配置Sonar完成,后续完善中文字符和Jekins的整合
 
参考网址:
 
 
 
 
 
 
            
 
 
 
        

Sonar安装-Linux[20171227]的更多相关文章

  1. findbug、p3c、checkstyle、sonar安装使用

    idea插件安装方式: Preferences—>Plugins—>查找插件—>Install Preferences—>Plugins—>Install plug fr ...

  2. 在VMware上安装Linux(CentOS)

    1. 新建虚拟机 2. 新建虚拟机向导 3. 创建虚拟空白光盘 4. 安装Linux系统对应的CentOS版 5. 虚拟机命名和定位磁盘位置 6. 处理器配置,看自己是否是双核.多核 7. 设置内存为 ...

  3. 安装 Linux 时碰到的硬盘分区的陷阱及应对

    硬盘分区的陷阱及应对 之所以想到写这篇,是因为本人在折腾 Linux 系统的过程中,有多次掉入硬盘分区的陷阱的经历.最近几天,再一次掉入坑中,折腾了两天才从坑中爬出来.经过多方查询资料,终于弄明白了硬 ...

  4. Win7上安装Linux双系统

    今天帮同学在Win7上安装Linux,感觉一篇教程很不错,mark一下 原地址:Win7下U盘安装Ubuntu14.04双系统步骤详解 一.前期准备 1.大于2G的U盘一个(我的系统盘制作完成后大约占 ...

  5. 安装linux操作系统

    安装双操作系统; 1 0. 介绍: 1 1 实验环境: 2 2. 实验准备: 2 3.开始安装: 2 1 制作U盘启动工具: 2 2.安装LinuxOS. 3 2.1在windowOS中划分60G空间 ...

  6. 使用ISO文件安装Linux

    一. 准备知识 1. ISO文件 我们普遍使用的ISO文件是指包含着整个CD-ROM(ISO-9660 文件系统)内容的 映象, 是整个碟片从0扇区到最后一个扇区的完整复制,经常被用来在网络上传输 对 ...

  7. VMware下安装Linux系统,ORACLE软件,DBCA建库

    操作系统安装   在vmware下安装Linux (OEL5.6),用于数据库服务器 1.打开vmware,选择"创建新的虚拟机"       2.选择自定义安装   3.选择虚拟 ...

  8. Linux:Vmware安装linux虚拟机,桥接方式配置静态IP后重启网卡,提示:Error,some other host already uses address 10.252.252.21...

    问题: Vmware安装linux虚拟机,桥接方式配置静态IP后重启网卡,提示:Error,some other host already uses address 10.252.252.21... ...

  9. 虚拟机上安装Linux操作系统

    很久之前就知道虚拟机这个东西,也都在虚拟机上安装过Windows的操作系统和Linux的操作系统,但是一直都没有去做笔记. 最近还是比较有时间,就移除了前两天刚刚安装的Linux系统,重新安装一次,做 ...

随机推荐

  1. Django分页解析

    分页 django中实现管理数据分页的类位于 django.core.paginator.py中 Paginator类 对列表数据进行分页处理 对象 Paginator(Post.objects.al ...

  2. 转:HTML中让图片滚动的<marquee>标签的使用方法

    实例: <marquee id="affiche" align="left" behavior="scroll" bgcolor=&q ...

  3. matlab练习程序(结构张量structure tensor)

    根据结构张量能区分图像的平坦区域.边缘区域与角点区域. 此算法也算是计算机科学最重要的32个算法之一了.链接的文章中此算法名称为Strukturtensor算法,不过我搜索了一下,Strukturte ...

  4. linux下的动态链接库管理

    LD_LIBRARY_PATH Linux环境变量名,该环境变量主要用于指定查找共享库(动态链接库)时除了默认路径之外的其他路径.(该路径在默认路径之前查找) 移植程序时的经常碰到需要使用一些特定的动 ...

  5. 好记性不如烂笔头-nginx安装环境与Linux安装ftp组件

    Nginx安装环境 1. Nginx安装环境 Nginx是C语言开发,建议在linux上运行,我参加工作这些年来一直使用Linux发行版之一的 Centos作为安装环境. 1.1 gcc 安装Ngin ...

  6. BIEE入门(二)物理层的定义

    使用BIEE的第一步是使用admintool去建立一个多维数据模型,而建立多维数据模型的第一步则是建立物理层,请注意因为BIEE本身并不存 储数据,所以所谓BIEE物理层的意义是需要在BIEE里建立各 ...

  7. 基于VB语言对SolidWorks参数化设计的二次开发

    0 引言 随着数字信息化进程的快速推进,如今三维CAD技术在越来越多的企业当中得到运用.为了降低在设计生产中的成本,缩短设计周期,增强企业竞争力,三维参数化技术随之应声,它凭借更贴近现代概念的设计以及 ...

  8. SOL的补充

    之前写过一些关于远程安装系统的文档,但是对于SOL还是糊涂不清. Serial Console 可以将输入输出转发到串行接口(com1, com2), 假如你有串行读取设备,就可以看到显示,控制输入. ...

  9. Golang Gin 项目使用 Swagger

    Golang Gin 项目使用 Swagger 标签(空格分隔): Go 首先需要github.com/swaggo/gin-swagger和github.com/swaggo/gin-swagger ...

  10. CRM中间件里的发布-订阅者模式

    从事务码SMW01里能观察到一个BDOC可能被发送往不止一个目的site去,比如下图所示的5个site都会收到该site,而高亮显示的SMOF_ERPSITE代表ERP系统QI3的client 504 ...