Installing Hudson

Unix/Linux Installation

Hudson has native integrations with the following OSes. See respective sections for how to make Hudson run in the background automatically:

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), then you 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.

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.

  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

    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.