Migrating from Tomcat to Tomcat
- Check that the JDK is installed.
- Download the Tomcat source package of the target version and decompress it to the Tomcat installation directory on the target host.
1 2
tar -zxvf apache-tomcat-8.5.100.tar.gz mv apache-tomcat-8.5.100 {src_tomcat_home}
- Modify the lib_mig.sh script and grant the execute permission on the script.
- Open the lib_mig.sh script.
1vi lib_mig.sh - Press i to enter the insert mode and add the following information to the lib_mig.sh file:
src_path="{src_tomcat_path}" dst_path="{dst_tomcat_path}" filter_list="catalina.jar tomcat-api.jar tomcat-util.jar servlet-api.jar tomcat-i18n-ja.jar tomcat-jni.jar catalina-storeconfig.jar tomcat-websocket.jar jasper.jar tomcat-jdbc.jar annotations-api.jar catalina-tribes.jar websocket-api.jar jaspic-api.jar ecj-4.5.1.jar tomcat-i18n-fr.jar catalina-ha.jar tomcat-dbcp.jar jasper-el.jar jsp-api.jar tomcat-i18n-es.jar catalina-ant.jar tomcat-coyote.jar tomcat-util-scan.jar el-api.jar" exclude_pattern="" for file in $filter_list; do exclude_pattern+=" -not -name '$file'" done eval "find '$src_path/lib' -type f $exclude_pattern -exec cp {} '$dst_path/lib' \;"
src_tomcat_path indicates the source Tomcat installation directory and dst_tomcat_path indicates the target Tomcat installation directory. Replace them with the actual paths.
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Grant the execute permission on the lib_mig.sh script and execute the script.The files that do not exist in filter_list in the tomcat/lib path on the source host are copied to the tomcat/lib directory on the target host.
1 2
chmod 700 lib_mig.sh ./lib_mig.sh
- Open the lib_mig.sh script.
- Migrate folders and extension files.
- Copy the webapps, logs, temp, and work folders in the source Tomcat directory to the Tomcat directory on the target host.
1cp -r {src_tomcat_path}/webapps {src_tomcat_path}/logs {src_tomcat_path}/temp {src_tomcat_path}/work {dst_tomcat_path}
- Copy the .xml, .properties, and .policy files in the conf directory of the source Tomcat to the conf directory of the target Tomcat.
1find {src_tomcat_path}/conf -type f \( -name "*.xml" -o -name "*.properties" -o -name "*.policy" \) -exec cp {} {dst_tomcat_path}/conf \;
- Copy the webapps, logs, temp, and work folders in the source Tomcat directory to the Tomcat directory on the target host.
- Start Tomcat.
1 2
cd {dst_tomcat_path}/bin ./startup.sh
- Access http://IP_address:Port/ to access the Tomcat home page.
Parent topic: Middleware Migration Guide