Install and Configure Hudson in redhat 6.x

Posted by Md. Mahidul Hasan on 2:53 AM with No comments
Install and Configure Hudson in redhat 6.x

Packages Requirements:
. Java
. Apache
. Apache-tomcat

Installing java:
Download the leatest java from http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html#jdk-7u10-oth-JPR
[root@hudson~]# mkdir -p /usr/jdk
[root@hudson~]# tar -zxvf /Packages/jdk-7u10-linux-x64.tar.gz -C /usr/jdk/
[root@hudson~]# ls /usr/jdk/jdk1.7.0_10/

Installing Apache2:
[root@hudson~]# yum install httpd -y
[root@hudson~]# service httpd restart
[root@hudson~]# chkconfig httpd on

Installing apache-tomcat:
[root@hudson~]# wget http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.36/bin/apache-tomcat-6.0.36.tar.gz
[root@hudson~]# tar -zxvf /Packages/apache-tomcat-6.0.36.tar.gz -C /usr/share/
[root@hudson~]# vim /usr/share/apache-tomcat-6.0.36/bin/catalina.sh
    #Add the following lines
    JAVA_HOME=/usr/jdk/jdk1.7.0_10/ 
    JAVA_OPTS="-Xms1024m -Xmx4096m -XX:PermSize=256m -XX:MaxPermSize=1024m -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled"

### Set Java Heap size: (memory allocation for java)
[root@hudson ~]# vim /usr/share/apache-tomcat-6.0.36/bin/setenv.sh
CATALINA_OPTS="-Djava.awt.headless=true -Xms1024m -Xmx10240m -XX:PermSize=1024m -XX:MaxPermSize=2048m"

[root@hudson~]# sh /usr/share/apache-tomcat-6.0.36/bin/startup.sh

[root@hudson~]# yum install -y nmap
[root@hudson~]# nmap localhost
    8080/tcp open  http-proxy

Sometimes apache-tomcat get stuck then pls kill the apache-tomcat process and restart from the below script.

[root@hudson~]# vim /usr/share/apache-tomcat-6.0.36/conf/tomcat-users.xml
# Append the beloow lines under the tomcat-users tag
  <role rolename="manager-gui"/>
  <user username="tomcat" password="your_tomcat_password" roles="manager-gui"/>
 
Now restart the apache-tomcat services:
[root@hudson~]# killall java
[root@hudson~]# sh /usr/share/apache-tomcat-6.0.36/bin/shutdown.sh
[root@hudson~]# sh /usr/share/apache-tomcat-6.0.36/bin/startup.sh

Now our server is ready. We can install hudson in two diffrent ways. First option is using war file and second is installing from repository as standalone service. Here I have presented both procedures. Lets get started.

Install hudson from war file:
First download leatest hudson.war:
[root@hudson ~]# wget http://eclipse.stu.edu.tw//hudson/war/hudson-3.1.2.war

Stop tomcat service:
[root@hudson ~]# /usr/share/apache-tomcat-6.0.36/bin/shutdown.sh
[root@hudson ~]# ps aux | grep tomcat
[root@hudson ~]# killall tomcat
[root@hudson ~]# kill -9 tomcat_id

Copy the hudson war to the tomcat webapps folder.
[root@hudson ~]# cp hudson-3.1.2.war /usr/share/apache-tomcat-6.0.36/webapps/hudson.war

Make hudson home directory and give proper permission:
[root@hudson ~]# mkdir /usr/share/apache-tomcat-6.0.36/.hudson/
[root@hudson ~]# chown tomcat.tomcat -R /usr/share/apache-tomcat-6.0.36/.hudson/

Startup tomcat and check the logs:
[root@hudson ~]# /usr/share/apache-tomcat-6.0.36/bin/shartup.sh
[root@hudson ~]# tail -f /usr/share/apache-tomcat-6.0.36/logs/catalina.out

Wait until all of your web applications loaded. Now go to the web browser, install your required plugins and complete the installation.
http://your_ip_address:8080/hudson/

Note: If you are not getting the hudson you may need to restart the war from tomcat manager (http://your_ip_address:8080).

Install hudson (standalone) from rpm:

[root@hudson ~]# wget -O /etc/yum.repos.d/hudson.repo http://hudson-ci.org/redhat/hudson.repo
[root@hudson ~]# yum check-update
[root@hudson ~]# yum install hudson
[root@hudson ~]# /etc/init.d/hudson start
[root@hudson ~]# tail -f /var/log/hudson/hudson.log

Thats all. Hope this helps you.



Reference:
http://docs.oracle.com/middleware/1212/core/MAVEN/config_hudson.htm#A1001805