Operations 4 min read

Jenkins Migration Guide: Environment Preparation and Step-by-Step Procedure

This article provides a detailed Jenkins migration guide, covering environment preparation, Tomcat configuration, permission settings, script adjustments, data copying, and troubleshooting tips to ensure a smooth transition to a new production server.

360 Quality & Efficiency
360 Quality & Efficiency
360 Quality & Efficiency
Jenkins Migration Guide: Environment Preparation and Step-by-Step Procedure

Jenkins is widely used in testing, and migration becomes necessary due to machine decommission, resource constraints, or task conflicts.

Environment preparation : Install Tomcat, JDK, and other Jenkins dependencies on the new machine; multiple independent Jenkins instances can run on the same host if resources are limited.

Steps:

Copy the Tomcat installation package to the target directory and modify conf/server.xml to change three ports, ensuring they are free.

Give execution permission to Tomcat's bin scripts: chmod +x *.sh.

Add the new Tomcat paths to ~/.bash_profile:

export CATALINA_BASE2=/home/xxxx/software/apache-tomcat-7.0.59
export CATALINA_HOME2=/home/xxxx/software/apache-tomcat-7.0.59

then run source ~/.bash_profile.

Edit startup.sh and shutdown.sh as needed (details omitted).

In catalina.sh, set the Jenkins home directory to avoid using the default ~/.jenkins, which could conflict with the previous instance.

Start Jenkins with sh startup.sh.

After the environment is ready, copy the original Jenkins home directory (including config.xml, jobs, users, workspace, and plugins directories) to the new location, then restart Jenkins. Ensure file ownership is changed to the Tomcat user (e.g., chown -R tomcat:tomcat <directory>) to prevent permission issues.

If problems arise during startup, check the Jenkins log directory for clues such as port conflicts.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

migrationci/cdOperationsDevOpsTomcatJenkins
360 Quality & Efficiency
Written by

360 Quality & Efficiency

360 Quality & Efficiency focuses on seamlessly integrating quality and efficiency in R&D, sharing 360’s internal best practices with industry peers to foster collaboration among Chinese enterprises and drive greater efficiency value.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.