sonar之安装篇

sonar 是一个很好的质量度量平台,安装方式有很多种。下面我教大家使用j2ee 容器的方式安装,我们使用tomcat

1.准备:

1.1 环境redhat linux
1.2 下载sonar 从http://www.sonarsource.org/
1.3  安装mysql,一般系统自带的就可以,直接使用service mysql start 即可启动
1.4  需要jdk1.6 的版本
1.5 下载tomcat,从tomcat.apache.org,版本6.0 系列

2. 安装

2.1首先建一个目录:mkdir /soft

2.2 cp sonar$version.zip /soft

2.3 cp tomcat$version.zip /soft

2.4 解压sonar 和tomcat 使用unzip 命令

2.5 cd /soft/sonar$vesion

2.6 修改 conf/sonar.properties 如下

# The schema must be created first.
sonar.jdbc.username:                       sonar
sonar.jdbc.password:                       sonar
#----- MySQL 5.x/6.x
# Comment the embedded database and uncomment the following line to
use MySQL
sonar.jdbc.url:                            jdbc:mysql://localhost:3306/sonar?user=sonar&password=sonar&useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true
# Optional properties
sonar.jdbc.driverClassName:                com.mysql.jdbc.Driver
sonar.jdbc.validationQuery:                select 1


2.7 在mysql 里创建数据库sonar,及其使用sonar,sonar 用户名和密码访问授权操作,命令如下:

mysql
mysql>create database sonar;
mysql>grant all on *.* to sonar@'localhost' identified by 'sonar';
mysql>grant all on *.* to sonar@'%' identified by 'sonar';
mysql>flush privileges;


2.8 build sonar 的war 包,修改文件 /soft/sonar$version/war/sonar-server/WEB-INF/classes/sonar-war.properties
SONAR_HOME=/soft/sonar$version (即sonar 的解压目录)
cd /soft/sonar$version/war
sh ./build-war.sh

2.9 复制 sonar.war 到tomcat/webapps/

2.10 修改tomcat 参数,修改$tomcat_home/bin/catalina.sh, 添加如下
CATALINA_OPTS="-Xmx1024m -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true -XX:MaxPermSize=256m"

2.11 启动tomcat,cd $tomcat_home/bin; sh ./startup.sh

3. 访问sonar:htt://localhost:8080/sonar ,使用admin,admin 即可登录



更多资料关注:www.kootest.com ;技术交流群:182526995

猜你喜欢

转载自kootest.iteye.com/blog/2155199