标签:
CentOS7 SonarQube安装
设定Postgres数据库
su postgres
psql -U postgres
CREATE USER sonar WITH PASSWORD ‘sonar‘;
CREATE DATABASE sonar WITH OWNER sonar ENCODING ‘UTF8‘;
\q
上传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
标签:
原文地址:http://www.cnblogs.com/tjpanda88/p/4306152.html