`
ezerg
  • 浏览: 268104 次
  • 性别: Icon_minigender_1
  • 来自: 石家庄
社区版块
存档分类
最新评论

CentOS 4.8 安装和配置基于 svn 的 hudson 持续集成环境(二)

阅读更多
涉及软件:ant , junit , emma , findbugs, mysql, tomcat和tomcat-native, apache, php, mantis , subversion, sonar , maven2 , hudson和相关插件包

七、安装SVN并设置变量
解压源码包 subversion-1.6.5.tar.gz 和 subversion-deps-1.6.5.tar.gz ,两个压缩包会解压缩到同一个目录。
# ./configure --prefix=/usr/local/svn --with-apxs=/usr/local/apache2/bin/apxs --with-apr=/usr/local/apache2/bin/apr-config --with-apr-util=/usr/local/apache2/bin/apu-config --enable-maintainer-mode
# make
# make install

安装完成后创建svn用户和资源库
# useradd svn
# mkdir /opt/svn
# chown –R svn:svn /opt/svn
# su – svn

将svn的bin路径加入到PATH
$ vi .bash_profile
$ . .bash_profile
创建 repository 资源库
$ svnadmin create /opt/svn/repository

配置svn的用户权限,注意参数前面一定不要有空格
$ vi /opt/svn/repository/conf/svnserve.conf
[general]
Anon-access = none
Auth-access = write
Password-db = /opt/svn/conf/pwd.conf
Authz-db = /opt/svn/conf/authz.conf
Realm = repository

增加公共资源库的用户和权限
$ vi /opt/svn/conf/pwd.conf
admin=admin
$ vi /opt/svn/conf/authz.conf
[repository:/]
admin = rw



创建并修改相应的配置文件,启动服务
# svnserve –d –r /opt/svn

支持apache访问
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
<Location /svn>
DAV svn 
SVNPath /opt/svn/repository  #实际SVN库目录
</Location>

支持中文目录赋权
将配置文件 auth.conf 通过UltraEdit转化为UTF-8格式(ASCII 转 UTF-8)即可



八、安装SONAR
解压缩 sonar 包到 /opt/sonar/ 目录。

配置 mysql 数据库
# /usr/local/mysql/bin/mysql -uroot
> create database sonar charset utf8 collate utf8_general_ci;
> grant all privileges on sonar.* to 'sonar' identified by 'sonar';
> grant all privileges on sonar.* to 'sonar'@'localhost' identified by 'sonar';
> flush privileges;

修改 /opt/sonar/conf/sonar.properties 配置
# MySql
# uncomment the 3 following lines to use MySQL
sonar.jdbc.url:                            jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8
sonar.jdbc.driverClassName:                com.mysql.jdbc.Driver
sonar.jdbc.validationQuery:                select 1

启动:/opt/sonar/bin/linux-x86-32/sonar.sh start

打开浏览器,输入网址:http://IP地址:9000/
默认的用户名和密码:admin/admin



九、安装MAVEN2并设置变量,
解压缩 maven 包到 /opt/maven2/ 目录。

复制 repository 到 /opt/maven2/ 目录,并修改 /opt/maven2/conf/settings.xml 配置文件
<localRepository>/opt/maven2/repository</localRepository>

修改 maven 启动文件 /opt/maven2/bin/mvn
set MAVEN_OPTS=-Xms128m -Xmx256m

整合SONAR
修改 /opt/maven2/conf/settings.xml 配置文件
    <profile>
      <id>sonar</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <sonar.jdbc.url>jdbc:mysql://localhost:3306/sonar</sonar.jdbc.url>
        <sonar.jdbc.driver>com.mysql.jdbc.Driver</sonar.jdbc.driver>
        <sonar.jdbc.username>sonar</sonar.jdbc.username>
        <sonar.jdbc.password>sonar</sonar.jdbc.password>
        <sonar.host.url>http://localhost:9000</sonar.host.url>
      </properties>
    </profile>

测试一下:/opt/maven2/bin/mvn

编辑 ci.sh 增加如下内容:
export M2_HOME=/opt/maven2



十、安装HUDSON到TOMCAT并设置变量
修改TOMCAT配置文件 /opt/tomcat/conf/server.xml
<Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000" enableLookups="false"
               redirectPort="8443" URIEncoding="UTF-8"/>

修改catalina.sh
CATALINA_OPTS="-Xms256m -Xmx256m -Dfile.encoding=GBK -Djava.library.path=/opt/tomcat/apr/lib -Djava.awt.headless=true "

将 hudson.war 复制到 /opt/tomcat/webapps 目录中,并安装相关的插件。
包括 emma.hpi, findbugs.hpi, ftppublisher.hpi mantis.hpi sonar.hpi ,大家可以在网上下载
# cp *.hpi /opt/tomcat/webapps/hudson/WEB-INF/plugins/

编辑 ci.sh 增加如下内容:
export HUDSON_HOME=/opt/hudson
PATH=/opt/sonar/bin/linux-x86-32:$M2_HOME/bin:$FINDBUGS_HOME/bin:$ANT_HOME/bin:$JAVA_HOME/bin:$PATH
export PATH

启动 TOMCAT 。

打开浏览器,输入网址:http://IP地址:8080/hudson/
可以在左侧导航栏点击“Manager Hudson”,进入界面后点击"Manage Plugins",进入界面后点击“Installed”标签,查看已经安装的插件。

至此,我们需要安装的软件已经全部安装完成!接下来的操作,都是通过 hudson 的界面来完成。


待续
0
3
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics