Sonar安裝-Linux[20171227]

来源:https://www.cnblogs.com/also-brook/archive/2017/12/28/8135524.html
-Advertisement-
Play Games

前言 一款不錯的代碼質量管理工具Sonar 前期準備 官方參考文檔 https://docs.sonarqube.org/display/SONAR/Documentation 軟體下載 https://www.sonarqube.org/downloads/ https://dev.mysql.c ...


前言     一款不錯的代碼質量管理工具Sonar 前期準備     官方參考文檔 https://docs.sonarqube.org/display/SONAR/Documentation     軟體下載          https://www.sonarqube.org/downloads/          https://dev.mysql.com/downloads/mysql/     硬體環境(在官方參考文檔有提出硬體規格,如下只是測試環境)             磁碟 ->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 baseurl=http://192.168.1.51/redhat6.5/Server 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 = 262144
  fs.file-max = 65536
 
[root@t-xi-sonar01 ~]# vi /etc/security/limits.conf
    #add sonar
    sonarqube   -   nofile   65536
    sonarqube   -   nproc    2048
 
sysctl -w vm.max_map_count=262144
sysctl -w fs.file-max=65536
ulimit -n 65536
ulimit -u 2048

安裝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               優化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=2
innodb_thread_concurrency=8
innodb_flush_method=O_DIRECT
transaction-isolation=READ-COMMITTED
thread_cache_size=4
slow_query_log=on
slow-query-log-file=mysqld-slow.log
long_query_time=10
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的整合   參考網址:       https://tpu.thinkpower.com.tw/tpu/File/html/201703/20170306175812_f.html?f=3dj6j8kd38895ksgtdddd93865jhr9sn3rqkh     https://www.ibm.com/developerworks/cn/java/j-lo-sonar/index.html                                      
您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 註:歡迎大家轉載,非商業用途請在醒目位置註明本文鏈接和作者名dijia478,商業用途請聯繫本人[email protected]。 之前步驟:Solr集群搭建詳細教程(一) 三、solr集群搭建 註意,在搭建solr集群前,建議最好有一個solr服務是已經搭建好的,可以簡化大量重覆的配置操作。 單機 ...
  • http://blog.csdn.net/taokai_110/article/details/72934818 終於解決了問題 ...
  • 22.添加附加文件刪除後,文件大小沒有發生改變的(優化文件和清空回收站) ...
  • LabVIEW的TCP/IP函數庫非常好用,但是不恰當地設置打開連接結點的參數將帶來一些問題,麻煩。如下圖的打開連接的參數設置: 上圖中指定了本地的埠,會發生這樣的情況。當我們關閉應用程式之後,連接被關閉,按照TCP/IP的協議,連接會話資源會處於一種time_wait的狀態,存活一段時間,一般都 ...
  • 當新增硬碟時,要做的幾個事情就是:先按需要進行分區、然後對分區進行格式化、再進行掛載即將指定分區掛到指定目錄上;必要的時候做下校驗; 常用的命令有: fdisk :磁碟分區相關指令 如:查看 新增 刪除 合併 分區等 partproabe:重讀分區表 mkfs:將分區格式化成指定文件系統格式 mou ...
  • 1.在macOS High Sierras上安裝VMware for mac 下載地址:VMware Fusion 8.5.1 https://pan.baidu.com/s/1skQ1OyL 2.Ubuntu14.04安裝 2.1 下載ubuntu14.04鏡像文件 下載地址:中科大鏡像源 htt ...
  • 操作前需要以下軟體,且,Ubuntu已經安裝在VMware Workstation上。 Ubuntu16.04 LTSVMware WorkstationSecureCRT VMware的編輯tab >虛擬網路編輯 菜單查看網路配置: 子網IP:192.168.92.0子網掩碼:255.255 ...
  • 本節總結: uboot啟動流程如下: 1)設置CPU為管理模式 2)關看門狗 3)關中斷 4)設置時鐘頻率 5)關mmu,初始化各個bank 6)進入board_init_f()函數 (初始化定時器,GPIO,串口等,劃分記憶體區域) 7)重定位 複製uboot,然後修改SDRAM上的uboot鏈接地 ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...