CentOS 4.8 安装和配置基于 svn 的 hudson 持续集成环境(一)
涉及安装的软件:ant , junit , emma , findbugs, mysql, tomcat和tomcat-native, apache, php, mantis , subversion, sonar , maven2 , hudson和相关插件包
一、安装JDK并设置变量 我下载的 rpm 安装包,默认安装到 /usr/java/jdk1.6.0_16/ 目录。
作为统一集成环境变量的管理,创建 ci.sh 并复制到 /etc/profile.d/ 目录。 编辑 ci.sh 增加如下内容: export JAVA_HOME=/usr/java/jdk1.6.0_16 export CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
二、安装ANT并设置变量 解压缩 ant 包到 /opt/ant/ 目录,并复制 junit.jar 到 /opt/ant/lib/ 目录。
编辑 ci.sh 增加如下内容: export ANT_HOME=/opt/ant
三、安装FINDBUGS并设置变量 解压缩 findbugs 包到 /opt/findbugs/ 目录,复制 /opt/findbugs/lib/findbugs-ant.jar 到 /opt/ant/lib/ 目录
编辑 ci.sh 增加如下内容: export FINDBUGS_HOME=/opt/findbugs
四、安装MYSQL 解压缩 mysql-5.1.54.tar.gz 源码包,进入安装目录。 静态编译的方式
./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data --enable-thread-safe-client --enable-local-infile --enable-assembler --enable-community-features --enable-profiling --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --with-charset=utf8 --with-collation=utf8_general_ci --with-extra-charsets=all --with-mysqld-user=mysql --without-embedded-server --with-big-tables --with-server-suffix=-community --with-unix-socket-path=/usr/local/mysql/etc/mysql.sock --without-debug --without-man --without-docs --with-plugins=partition,blackhole,csv,federated,heap,innobase,myisam
make
make install
编译完成后的配置
useradd ysql
cd /usr/local/mysql
cp share/mysql/my-medium.cnf /etc/my.cnf
mkdir etc
安装数据库文件
./bin/mysql_install_db
chown -R mysql:mysql .
./bin/mysqld_safe --user=mysql &
如果需要使用 Innodb Plugin 的特性,则需要动态编译的方式 注意:动态编译 innodb_plugin 需要升级 CentOS4.9的 gcc 版本,我升级到4.2.1,默认的版本总是编译失败
export CFLAGS="-O2 -DHAVE_DLOPEN=1"
export CXXFLAGS="-O2 -DHAVE_DLOPEN=1"
./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data --enable-thread-safe-client --enable-local-infile --enable-assembler --enable-community-features --enable-profiling --with-charset=utf8 --with-collation=utf8_general_ci --with-extra-charsets=all --with-mysqld-user=mysql --without-embedded-server --with-big-tables --with-server-suffix=-community --with-unix-socket-path=/usr/local/mysql/etc/mysql.sock --without-debug --without-man --without-docs --with-plugins=partition,blackhole,csv,federated,heap,innobase,innodb_plugin,myisam --disable-static
修改配置 my.cnf 增加如下内容:
my.cnf
ignore_builtin_innodb plugin_load=innodb=ha_innodb_plugin.so innodb_file_format=barracuda innodb_file_per_table innodb_strict_mode=1
5、安装 TOMCAT 解压缩 tomcat 包到 /opt/tomcat/ 目录。 首先编译安装 tomcat-native 包,这是Apache为了提升Tomcat的性能开发的一套本地化Socket,Thread,IO组件。也就是说它有高级IO功能,操作系统级别的功能调用,以及本地进程处理等等。 1、安装 APR http://apr.apache.org下载apr-1.4.2.tar.gz
tar –zxvf apr-1.4.2.tar.gz
./configure --prefix=/opt/tomcat/apr
make && make install
2、安装APR-UTIL
http://apr.apache.org下载apr-util-1.3.9.tar.gz
tar –xvf apr-util-1.3.9.tar.gz
./configure --prefix=/opt/tomcat/apr --with-apr=/opt/tomcat/apr
make && make install
3、安装tomcat native library (tomcat安装包的bin目录下)
tar zxvf tomcat-native.tar.gz
cd tomcat-native-1.1.20-src/jni/native
./configure --prefix=/opt/tomcat/apr/ --with-apr=/opt/tomcat/apr/ --with-java-home=/usr/java/jdk1.6.0_16/
make && make install
4、配置使tomcat启动时找到native library 修改配置 /bin/catalina.sh 增加如下内容: CATALINA_OPTS="-Djava.library.path=/opt/tomcat/apr/lib" JAVA_HOME="/usr/java/jdk1.6.0_16"
设置完成,用 tomcat 控制台启动
/opt/tomcat/bin/catalina.sh run
Tomcat 的 AprLifecycleListener 会通过反射调用 org.apache.tomcat.jni.Library 的 terminate 方法,检测和加载动态库。详细情况请大家看源代码吧。
6、安装 MANTIS 1、安装apache2 解压缩安装包并进行安装目录
./configure --enable-dav --enable-so
make && make install
2、安装php
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --enable-mbstring
make
make test
make install
复制PHP.INI文件到正确位置
cp php.ini-dist /usr/local/php/lib/php.ini
enable-mbstring启用mb_convert_encoding 修改php.ini配置文件,去掉注释:extension=php_mbstring.so
编辑httpd.conf文件,加载php模块 AddType application/x-httpd-php .php
安装Mantis具体简略过程 解压缩 mantis 包到 /usr/local/apache2/htdocs/mantis 目录,启动 apache 通过浏览器访问 http://127.0.0.1/mantis/admin/install.php
提示安装成功后,复制config_inc.php.sample为config_inc.php并修改连接数据库参数
默认管理员用户:administrator/root
1、解决安装过程中报内存耗尽的问题 修改PHP配置文件 php.ini ,增加内存限制 memory_limit = 32M
2、修改Mantis配置文件config_defaults_inc.php
a、取消创建用户时需要发送邮件设置密码的问题 $g_send_reset_password = OFF;
b、使用中文界面 $g_default_language = 'chinese_simplified';
3、CSV导出乱码问题 修改 csv_export.php 增加如下内容: ...... function expChangeCode($str){ return mb_convert_encoding($str,"CP936","UTF-8"); } ...... #echo $t_header; echo expChangeCode($t_header); ...... #echo $t_value; echo expChangeCode($t_value); ...... # echo $t_function( $t_row ); echo expChangeCode($t_function( $t_row )); ......
未完,待续