Moving a Jenkins Instance From one Server to Another


During my time converting ZDirect’s SVN repo to Git, we decided to move our code from a server in Florida to a server in Ottawa. The same server also hosts our Jenkins build server. To keep bandwidth bills and build latency down we’re moving the Jenkins server over as well.

Trial and error led me to copying the entire Jenkins directory, which is either at the JENKINS_HOME environment variable or ~/.jenkins as the default. Launching the Jenkins executable while setting the JENKINS_HOME environment variable will bring up an almost perfectly configured instance of Jenkins. I say almost because the Jenkins configuration should be looked over for any settings that are wrong for this new system. Some Jenkins configuration options that I had to change was the JDK home, Ant home and the external url of the server. An example launch script looks as follows:

$ JENKINS_HOME=/path/to/jenkins/home/folder<br></br>$ java -jar jenkins.war<br></br>

The Jenkins Wiki outlines how to move specific jobs as well.