Installing Hudson

This page has been migrated to the Eclipse Hudson Web site:

http://wiki.eclipse.org/Hudson-ci/Installing_Hudson

Please update your bookmarks.

Prerequisites

Hudson only needs a Java 6 or newer runtime.

WAR file

After you download hudson.war, you can launch it by executing java -jar hudson.war. This is mostly useful for testing purposes. For production we recommend using native packages for simplified install or deployment in a servlet container that supports Servlet 2.4/JSP 2.0 or later, such as Glassfish, Tomcat 5, JBoss, Jetty 6, etc. See this document for more about container-specific installation instruction.

Once the war file is exploded, run chmod 755 hudson in the exploded hudson/WEB-INF directory so that you can execute this shell script.

Unix/Linux Installation

The Hudson project provides native packages for various Linux distributions. These are the simplest way to run Hudson in production, since the packages set up user, service and all other configuration as well as integrate with the native upgrade mechanism of the operating system.

For other operating systems check out the following pages for help.

Alternatively, if you have a servlet container that supports Servlet 2.4/JSP 2.0, such as Glassfish v2, Tomcat 5 (or any later versions), ou can run them as services, and deploy hudson.war as you would any other war file. Container specific documentation is available if you choose this route.
Top of page

Windows Installation

If you're running on Windows you might want to run Hudson as a service so it starts up automatically without requiring a user to log in. The easiest way is follow Installing Hudson as a Windows service. Alternatively, you can install a servlet container like GlassFish and Tomcat, which can run as a service by itself, and then deploy Hudson to it.

Since Hudson was written to work on unix-like platforms, some parts assume the presence of unix-utilities. It is advised to install these as well on Windows. Install UnxUtils (this includes a shell that seems to work with forward and backwards slashes and does globbing correctly), put it in the Windows PATH, and copy sh.exe to C:\bin\sh.exe (or whichever drive you use) to make shebang lines work. This should get you going.

If you're running on Windows you might want to run Hudson as a service so it starts up automatically without requiring a user to log in. One way is to first install Tomcat as a service and then deploy Hudson to it in the usual way.  Another way is to use the Java Service Wrapper. However, there may be problems using the service wrapper, because the Main class in Hudson in the default namespace conflicts with the service wrapper main class. Deploying inside a service container (Tomcat, Jetty, etc.) is probably more straightforward, even for developers without experience with such containers.

Top of page

Case Studies

Also, see how other people are deploying Hudson to get some idea of how to make it fit your environment.

Top of page

Labels:

Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.
  1. Dec 18, 2007

    Anonymous says:

    Regarding Unix/Linux, it would be nice to easily find a start/stop script to dep...

    Regarding Unix/Linux, it would be nice to easily find a start/stop script to deploy under /etc/rc* so it is ensured Hudson starts after a reboot.

  2. Jan 09, 2008

    Anonymous says:

    I used a simple script in /etc/rc.d/init.d in conjuction with the Fedora "chkcon...

    I used a simple script in /etc/rc.d/init.d in conjuction with the Fedora "chkconfig" command to create a linux service. Here's the script including the chkconfig parms included as comments. Do a "man ckkconfig" for more details on chkconfig. #!/bin/bash # # hudson This shell script starts the Hudson continuous integration # service. # # chkconfig: 2345 64 36 # description: The Hudson CI server # processname: mysqld java -jar /root/hudson/hudson.war --httpPort=18080 --ajp13Port=18009 >/root/huds on/hudson.log 2>&1

    1. Jan 10, 2008

      Anonymous says:

      I've made some minor and not so minor changes to the above init.d script - here'...

      I've made some minor and not so minor changes to the above init.d script - here's the new (and more readable) version:

      #!/bin/bash # # hudson This shell script starts the Hudson continuous
      integration service. # chkconfig: 2345 64 36 # description: The Hudson CI server . /etc/profile nohup java -jar /root/hudson/hudson.war --httpPort=18080 --ajp13Port=18009 >/root/huds on/hudson.log 2>&1 &
      


      1. Jan 27, 2008

        Anonymous says:

        Here's an even more elaborate init.d script: #!/bin/bash # # Startup script for...

        Here's an even more elaborate init.d script:

        #!/bin/bash
        #
        # Startup script for Hudson
        #
        # chkconfig: - 84 16
        # description: Hudson CI server
        
        # Source function library.
        . /etc/rc.d/init.d/functions
        [ -z "$JAVA_HOME" -a -x /etc/profile.d/java.sh ] && . /etc/profile.d/java.sh
        
        HUDSON_HOME=/var/hudson
        WAR="$HUDSON_HOME/hudson.war"
        LOG="/var/log/hudson.log"
        LOCK="/var/lock/subsys/hudson"
        export HUDSON_HOME
        
        RETVAL=0
        
        pid_of_hudson() {
            ps auxwww | grep java | grep hudson | grep -v grep | awk '{print $2}'
        }
        
        start() {
            [ -e "$LOG" ] && cnt=`wc -l "$LOG" | awk '{ print $1 }'` || cnt=1
        
            echo -n $"Starting hudson: "
        
            cd "$HUDSON_HOME"
            nohup java -jar "$WAR" --httpPort=-1 --ajp13Port=8010 --prefix=/hudson >> "$LOG" 2>&1 &
        
            while { pid_of_hudson > /dev/null ; } &&
                  ! { tail +$cnt "$LOG" | grep -q 'Winstone Servlet Engine .* running' ; } ; do
                sleep 1
            done
        
            pid_of_hudson > /dev/null
            RETVAL=$?
            [ $RETVAL = 0 ] && success $"$STRING" || failure $"$STRING"
            echo
        
            [ $RETVAL = 0 ] && touch "$LOCK"
        }
        
        stop() {
            echo -n "Stopping hudson: "
        
            pid=`pid_of_hudson`
            [ -n "$pid" ] && kill $pid
            RETVAL=$?
            cnt=10
            while [ $RETVAL = 0 -a $cnt -gt 0 ] &&
                  { pid_of_hudson > /dev/null ; } ; do
                sleep 1
                ((cnt--))
            done
        
            [ $RETVAL = 0 ] && rm -f "$LOCK"
            [ $RETVAL = 0 ] && success $"$STRING" || failure $"$STRING"
            echo
        }
        
        status() {
            pid=`pid_of_hudson`
            if [ -n "$pid" ]; then
                echo "hudson (pid $pid) is running..."
                return 0
            fi
            if [ -f "$LOCK" ]; then
                echo $"${base} dead but subsys locked"
                return 2
            fi
            echo "hudson is stopped"
            return 3
        }
        
        # See how we were called.
        case "$1" in
          start)
            start
            ;;
          stop)
            stop
            ;;
          status)
            status
            ;;
          restart)
            stop
            start
            ;;
          *)
            echo $"Usage: $0 {start|stop|restart|status}"
            exit 1
        esac
        
        exit $RETVAL
        
        1. Jul 11, 2008

          Stefan Groschupf says:

          Attention this script at least in my case overwrote the PATH variable, what caus...

          Attention this script at least in my case overwrote the PATH variable, what caused my perforce plugin to not find the p4 executable.
          So you want to add a line in the script to add the p4 executables to the path again.

  3. Feb 26, 2008

    Anonymous says:

    To Anon of the Jan 27 2008 post :  That script works great, thanks for tha...

    To Anon of the Jan 27 2008 post :

     That script works great, thanks for that

     
    G

  4. Jun 12, 2009

    Mark Wolff says:

    I have hudson running as a widows service and now I need to change the port numb...

    I have hudson running as a widows service and now I need to change the port number.  On previous installs, I fixed this before I set up the windows service.  Can I change the port number now?

    1. Jul 14, 2009

      Robert Lieske says:

      You can configure that in hudson.xml Look for httpPort in the <arguments>...

      You can configure that in hudson.xml

      Look for httpPort in the <arguments> line.

      1. Sep 22, 2011

        Nagaraju says:

        I didnot find hudson.xml file in hudson.war. Please Tell me the exact location ...

        I didnot find hudson.xml file in hudson.war. Please

        Tell me the exact location in hudson.war file

  5. Sep 06, 2009

    Heiko Maass says:

    Another alternative for the init script is the Tanuki Service Wrapper. They alre...

    Another alternative for the init script is the Tanuki Service Wrapper. They already provide an example for hudson:

    http://wrapper.tanukisoftware.org/doc/english/integrate-jar-win.html

  6. May 03, 2010

    Dave Enfield says:

    I am using Hudson on Windows XP 64-bit.  I have been using version 1.320 an...

    I am using Hudson on Windows XP 64-bit.  I have been using version 1.320 and I tried to upgrade to 1.352.  Unfortunately when I upgraded to 1.352, I was unable to login to Hudson.  I am running Hudson as a Windows service. 

    Here is the procedure that I followed:

    1. Stop the Windows service for Hudson

    2. Copy the WAR file to c:\hudson

    3. Start the Windows service

    After doing this and not being able to login, I followed the same procedure to roll back to 1.320 and was able to login again.

  7. Sep 25, 2011

    Nagaraju says:

    Hi, I am running hudson.war in my tomcat server .It works fine for some time .B...

    Hi,

    I am running hudson.war in my tomcat server .It works fine for some time .But when i start the server suddenly i got following error how to resolve it Please please tell meorg.jvnet.hudson.reactor.ReactorException: hudson.util.IOException2: Unable to read D:\Test\Test\hudson\config.xml
    at org.jvnet.hudson.reactor.Reactor.execute(Reactor.java:246)
    at hudson.model.Hudson.executeReactor(Hudson.java:727)
    at hudson.model.Hudson.(Hudson.java:630)
    at hudson.model.Hudson.(Hudson.java:568)
    at hudson.WebAppMain$2.run(WebAppMain.java:248)
    Caused by: hudson.util.IOException2: Unable to read D:\Test\Test\hudson\config.xml
    at hudson.XmlFile.unmarshal(XmlFile.java:152)
    at hudson.model.Hudson$12.run(Hudson.java:2359)
    at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:146)
    at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:259)
    at hudson.model.Hudson$4.runTask(Hudson.java:707)
    at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:187)
    at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:94)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
    Caused by: com.thoughtworks.xstream.converters.ConversionException: only START_TAG can have attributes END_TAG seen ...ategy class="hudson.security.ProjectMatrixAuthorizationStrategy"/>... @7:86 : only START_TAG can have attributes END_TAG seen ...ategy class="hudson.security.ProjectMatrixAuthorizationStrategy"/>... @7:86
    --- Debugging information ---
    message : only START_TAG can have attributes END_TAG seen ...ategy class="hudson.security.ProjectMatrixAuthorizationStrategy"/>... @7:86
    cause-exception : java.lang.IndexOutOfBoundsException
    cause-message : only START_TAG can have attributes END_TAG seen ...ategy class="hudson.security.ProjectMatrixAuthorizationStrategy"/>... @7:86
    class : hudson.model.Hudson
    required-type : hudson.security.ProjectMatrixAuthorizationStrategy
    path : /hudson/authorizationStrategy
    line number : 7
    -------------------------------
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:89)
    at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:63)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:76)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:60)
    at hudson.util.RobustReflectionConverter.unmarshalField(RobustReflectionConverter.java:290)
    at hudson.util.RobustReflectionConverter.doUnmarshal(RobustReflectionConverter.java:233)
    at hudson.util.RobustReflectionConverter.unmarshal(RobustReflectionConverter.java:180)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:82)
    at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:63)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:76)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:60)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:137)
    at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:33)
    at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:926)
    at hudson.util.XStream2.unmarshal(XStream2.java:80)
    at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:912)
    at hudson.XmlFile.unmarshal(XmlFile.java:148)
    ... 9 more
    Caused by: java.lang.IndexOutOfBoundsException: only START_TAG can have attributes END_TAG seen ...ategy class="hudson.security.ProjectMatrixAuthorizationStrategy"/>... @7:86
    at org.xmlpull.mxp1.MXParser.getAttributeValue(MXParser.java:927)
    at com.thoughtworks.xstream.io.xml.XppReader.getAttribute(XppReader.java:93)
    at com.thoughtworks.xstream.io.ReaderWrapper.getAttribute(ReaderWrapper.java:56)
    at hudson.util.RobustReflectionConverter.instantiateNewInstance(RobustReflectionConverter.java:324)
    at hudson.util.RobustReflectionConverter.unmarshal(RobustReflectionConverter.java:179)
    at hudson.security.ProjectMatrixAuthorizationStrategy$ConverterImpl.unmarshal(ProjectMatrixAuthorizationStrategy.java:104)
    at hudson.util.XStream2$AssociatedConverterImpl.unmarshal(XStream2.java:224)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:82)
    ... 25 more

    1. Sep 26, 2011

      Winston Prakash says:

      Appears your Hudson config file (D:\Test\Test\hudson\config.xml) got corrupt. Se...

      Appears your Hudson config file (D:\Test\Test\hudson\config.xml) got corrupt. Seems the matrix configuration you modified did not applied correctly.

      P.S: For quick answers you might want to send e-mail to mailing list usersAThudsonDOTjavaDOTnet