ubuntu下安装sonarqube(团队代码评审工具)

1.先装好java,mysql,设置JAVA_HOME,JRE_HOME

2.在mysql中创建数据库和用户

CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'sonar' IDENTIFIED BY 'sonar';
GRANT ALL ON sonar.* TO 'sonar'@'%' IDENTIFIED BY 'sonar';
GRANT ALL ON sonar.* TO 'sonar'@'localhost' IDENTIFIED BY 'sonar';
FLUSH PRIVILEGES;

3.下载sonarqube,并解压,移动到opt目录

wget http://dist.sonar.codehaus.org/sonarqube-5.1.zip
unzip sonarqube-5.1.zip
mv sonarqube-5.1 /opt/sonar

4.编辑sonarqube.properties文件

Open /opt/sonar/conf/sonar.properties with your favourite text editor, and modify it.
MySQL settings
Uncomment the user credentials and the MySQL related settings

sonar.jdbc.username=sonar
sonar.jdbc.password=sonar

sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance

Web Server settings
The following settings allow you to run the server on page http://localhost:9000/sonar

sonar.web.host=0.0.0.0
sonar.web.context=/sonar
sonar.web.port=9000

Implement SonarQube server as a service [optional]

Copy sonar.sh to etc/init.d/sonar and modify it according to your platform.

sudo cp bin/linux-x86-64/sonar.sh /etc/init.d/sonar
sudo gedit /etc/init.d/sonar

Insert two new lines:

SONAR_HOME=/opt/sonar
PLATFORM=linux-x86-64

Modify the following lines:

WRAPPER_CMD="${SONAR_HOME}/bin/${PLATFORM}/wrapper"
WRAPPER_CONF="${SONAR_HOME}/conf/wrapper.conf"
...
PIDDIR="/var/run"

Register as a Linux service:

sudo update-rc.d -f sonar remove
sudo chmod 755 /etc/init.d/sonar
sudo update-rc.d sonar defaults
在/opt/sonar/conf/wrapper.conf文件中修改java路径

# Path to JVM executable. By default it must be available in PATH.
# Can be an absolute path, for example:
#wrapper.java.command=/path/to/my/jdk/bin/java
wrapper.java.command=/software/jdk1.8.0_65/bin/java



启动sonar:

sudo /etc/init.d/sonar start

停止sonar

sudo /etc/init.d/sonar stop
重启sonar

sudo /etc/init.d/sonar restart

打开浏览器输入:http://ip地址:9000/sonar/    



登录,之后在update center中安装相关插件



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值