{"id":589,"date":"2013-03-15T19:34:00","date_gmt":"2013-03-15T18:34:00","guid":{"rendered":"http:\/\/blog.rabahi.net\/?page_id=589"},"modified":"2014-08-04T17:35:50","modified_gmt":"2014-08-04T15:35:50","slug":"sonar","status":"publish","type":"page","link":"https:\/\/blog.rabahi.net\/?page_id=589","title":{"rendered":"Sonar"},"content":{"rendered":"<h1>Prerequiste<\/h1>\n<p>I assume that you have a Centos installation.<\/p>\n<h1>Installation<\/h1>\n<p>You can copy\/paste this script and use it to configure automatically your server.<\/p>\n<pre class=\"bash\" style=\"font-family:monospace;\"><ol><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #666666; font-style: italic;\">#!\/bin\/bash<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&quot;import sonar repository&quot;<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">sudo<\/span> <span style=\"color: #c20cb9; font-weight: bold;\">wget<\/span> <span style=\"color: #660033;\">-O<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>etc<span style=\"color: #000000; font-weight: bold;\">\/<\/span>yum.repos.d<span style=\"color: #000000; font-weight: bold;\">\/<\/span>sonar.repo http:<span style=\"color: #000000; font-weight: bold;\">\/\/<\/span>downloads.sourceforge.net<span style=\"color: #000000; font-weight: bold;\">\/<\/span>project<span style=\"color: #000000; font-weight: bold;\">\/<\/span>sonar-pkg<span style=\"color: #000000; font-weight: bold;\">\/<\/span>rpm<span style=\"color: #000000; font-weight: bold;\">\/<\/span>sonar.repo<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&quot;create database sonar, user\/password sonar\/sonar&quot;<\/span>:<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">mysql <span style=\"color: #660033;\">--user<\/span>=root <span style=\"color: #660033;\">--password<\/span>=root <span style=\"color: #660033;\">-e<\/span> <span style=\"color: #ff0000;\">&quot;CREATE USER 'sonar'@'localhost' IDENTIFIED BY 'sonar';&quot;<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">mysql <span style=\"color: #660033;\">--user<\/span>=root <span style=\"color: #660033;\">--password<\/span>=root <span style=\"color: #660033;\">-e<\/span> <span style=\"color: #ff0000;\">&quot;CREATE DATABASE IF NOT EXISTS sonar;&quot;<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">mysql <span style=\"color: #660033;\">--user<\/span>=root <span style=\"color: #660033;\">--password<\/span>=root <span style=\"color: #660033;\">-e<\/span> <span style=\"color: #ff0000;\">&quot;use sonar; GRANT ALL PRIVILEGES ON sonar.* TO 'sonar'@'localhost' WITH GRANT OPTION;&quot;<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&quot;install sonar&quot;<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">dnf <span style=\"color: #660033;\">-y<\/span> <span style=\"color: #c20cb9; font-weight: bold;\">install<\/span> sonar<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&quot;start sonar on boot&quot;<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">systemctl <span style=\"color: #7a0874; font-weight: bold;\">enable<\/span> sonar.service<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&quot;Configure sonar&quot;<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #666666; font-style: italic;\"># add # before each sonar.jdbc.url that are not commented:<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">sed<\/span> <span style=\"color: #660033;\">-i<\/span> <span style=\"color: #ff0000;\">&quot;s\/^\\(sonar.jdbc.url\\)\/#\\1\/&quot;<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>sonar<span style=\"color: #000000; font-weight: bold;\">\/<\/span>conf<span style=\"color: #000000; font-weight: bold;\">\/<\/span>sonar.properties<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #666666; font-style: italic;\"># remove comment for the sonar.jdbc.url in mysql part:<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">sed<\/span> <span style=\"color: #660033;\">-i<\/span> <span style=\"color: #ff0000;\">&quot;s\/^#\\(sonar.jdbc.url=.*jdbc:mysql\\)\/\\1\/&quot;<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>sonar<span style=\"color: #000000; font-weight: bold;\">\/<\/span>conf<span style=\"color: #000000; font-weight: bold;\">\/<\/span>sonar.properties<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #666666; font-style: italic;\"># user creditential:<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">sed<\/span> <span style=\"color: #660033;\">-i<\/span> <span style=\"color: #ff0000;\">&quot;s\/^#\\(sonar.jdbc.username=\\).*\/\\1sonar\/&quot;<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>sonar<span style=\"color: #000000; font-weight: bold;\">\/<\/span>conf<span style=\"color: #000000; font-weight: bold;\">\/<\/span>sonar.properties<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">sed<\/span> <span style=\"color: #660033;\">-i<\/span> <span style=\"color: #ff0000;\">&quot;s\/^#\\(sonar.jdbc.password=\\).*\/\\1sonar\/&quot;<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>sonar<span style=\"color: #000000; font-weight: bold;\">\/<\/span>conf<span style=\"color: #000000; font-weight: bold;\">\/<\/span>sonar.properties<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #666666; font-style: italic;\"># sonar web context<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">sed<\/span> <span style=\"color: #660033;\">-i<\/span> <span style=\"color: #ff0000;\">&quot;s\/^#\\(sonar.web.context=\\).*\/\\1\\\/sonar\/&quot;<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>sonar<span style=\"color: #000000; font-weight: bold;\">\/<\/span>conf<span style=\"color: #000000; font-weight: bold;\">\/<\/span>sonar.properties<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">sed<\/span> <span style=\"color: #660033;\">-i<\/span> <span style=\"color: #ff0000;\">&quot;s\/^\\(sonar.web.context=\\).*\/\\1\\\/sonar\/&quot;<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>sonar<span style=\"color: #000000; font-weight: bold;\">\/<\/span>conf<span style=\"color: #000000; font-weight: bold;\">\/<\/span>sonar.properties<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&quot;configure httpd (create \/etc\/httpd\/conf.d\/sonar.conf)&quot;<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">cat<\/span> <span style=\"color: #000000; font-weight: bold;\">&gt;<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>etc<span style=\"color: #000000; font-weight: bold;\">\/<\/span>httpd<span style=\"color: #000000; font-weight: bold;\">\/<\/span>conf.d<span style=\"color: #000000; font-weight: bold;\">\/<\/span>sonar.conf <span style=\"color: #000000; font-weight: bold;\">&lt;&lt;<\/span> <span style=\"color: #ff0000;\">&quot;EOF&quot;<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">ProxyPreserveHost On<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">Proxypass <span style=\"color: #000000; font-weight: bold;\">\/<\/span>sonar http:<span style=\"color: #000000; font-weight: bold;\">\/\/<\/span>localhost:<span style=\"color: #000000;\">9000<\/span><span style=\"color: #000000; font-weight: bold;\">\/<\/span>sonar<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">Proxypassreverse <span style=\"color: #000000; font-weight: bold;\">\/<\/span>sonar http:<span style=\"color: #000000; font-weight: bold;\">\/\/<\/span>localhost:<span style=\"color: #000000;\">9000<\/span><span style=\"color: #000000; font-weight: bold;\">\/<\/span>sonar<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">ProxyRequests     Off<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">EOF<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&quot;start service&quot;<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">systemctl restart httpd.service<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">systemctl start sonar.service<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #007800;\">myip<\/span>=<span style=\"color: #000000; font-weight: bold;\">`<\/span><span style=\"color: #c20cb9; font-weight: bold;\">hostname<\/span> -I<span style=\"color: #000000; font-weight: bold;\">`<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&quot;Now meet you here: http:\/\/<span style=\"color: #007800;\">$myip<\/span>\/sonar&quot;<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><\/ol><\/pre>\n<p>That&#8217;s all \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Prerequiste I assume that you have a Centos installation. Installation You can copy\/paste this script and use it to configure automatically your server. That&#8217;s all \ud83d\ude42<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":562,"menu_order":4,"comment_status":"closed","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-589","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/589","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=589"}],"version-history":[{"count":6,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/589\/revisions"}],"predecessor-version":[{"id":1022,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/589\/revisions\/1022"}],"up":[{"embeddable":true,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/562"}],"wp:attachment":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=589"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}