码迷,mamicode.com
首页 > 其他好文 > 详细

CentOS7 SonarQube安装

时间:2015-02-28 21:33:05      阅读:989      评论:0      收藏:0      [点我收藏+]

标签:

CentOS7 SonarQube安装

CentOS7 SonarQube安装

Download

Database

设定Postgres数据库

su postgres
psql
-U postgres
CREATE USER sonar WITH PASSWORD
‘sonar‘;
CREATE DATABASE sonar WITH OWNER sonar ENCODING
‘UTF8‘;
\q

Install

  • 安装

上传ZIP文件到/tmp目录下

mkdir /opt/sonar
cd
/opt/sonar
unzip
/tmp/sonarqube-5.0.zip
unzip
/tmp/sonar-runner-dist-2.4.zip

环境变量

在/etc/profile.d目录下新建sonar.sh

#!/bin/bash
SONAR_HOME
=/opt/sonar/sonarqube-5.0
SONAR_RUNNER_HOME
=/opt/sonar/sonar-runner-2.4
PATH
=$SONAR_RUNNER_HOME/bin:$PATH
export SONAR_HOME
export SONAR_RUNNER_HOME
export PATH

并赋予执行权限

chmod +x /etc/profile.d/sonar.sh
source
/etc/profile.d/sonar.sh

/opt/sonar/sonarqube-5.0/conf/sonar.properties sonar.jdbc.username=sonar sonar.jdbc.password=sonar sonar.jdbc.url=jdbc:postgresql://localhost/sonar sonar.web.context= sonar.web.port=9084 sonar.search.port=9085

/opt/sonar/sonar-runner-2.4/conf/sonar-runner.properties #Configure here general information about the environment, such as SonarQube DB details for example #No information about specific project should appear here

#----- Default SonarQube server
sonar
.host.url=http://localhost:9084

#----- PostgreSQL
sonar
.jdbc.url=jdbc:postgresql://localhost/sonar

#----- MySQL
#sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8

#----- Oracle
#sonar.jdbc.url=jdbc:oracle:thin:@localhost/XE

#----- Microsoft SQLServer
#sonar.jdbc.url=jdbc:jtds:sqlserver://localhost/sonar;SelectMethod=Cursor

#----- Global database settings
sonar
.jdbc.username=sonar
sonar
.jdbc.password=sonar

#----- Default source code encoding
sonar
.sourceEncoding=UTF-8

#----- Security (when ‘sonar.forceAuthentication‘ is set to ‘true‘)
sonar
.login=admin
sonar
.password=admin

新建/etc/init.d/sonar

#!/bin/sh

# chkconfig: - 80 20
# Description: SONAR

/opt/sonar/sonarqube-5.0/bin/linux-x86-64/sonar.sh $*
exit $?

赋予执行权限

chmod +x /etc/init.d/sonar

设定开机启动

chkconfig sonar on
  • 防火墙

新建文件/usr/lib/firewalld/services/sonar.xml

<?xml version="1.0" encoding="utf-8"?>
<service>
       
<short>Sonar Qube 5.0 service</short>
       
<description>SonarQube</description>
       
<portprotocol="tcp"port="9084"/>
</service>

修改防火墙设定

firewall-cmd --permanent --add-service=sonar
firewall
-cmd --reload

CentOS7 SonarQube安装

标签:

原文地址:http://www.cnblogs.com/tjpanda88/p/4306152.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!