We changed the server on which Jenkins is running, so we backed up Jenkins and reflected it on the new server.
Just a note in case I need to backup Jenkins again.
summary
Jenkins is well designed, and all you have to do is copy the entire Jenkins home directory and extract it to the Jenkins home directory at the migration site.
The Jenkins home directory is also listed in the environment variable "$JENKINS_HOME".
procedure
echo $JENKINS_HOME
- Check Jenkins home directory (in this case "/var/jenkins_home")
cd /var
tar zcf backup.tar.gz jenkins_home
- Compress the "jenkins_home" directory and save it in the file "backup.tar.gz
- At the transition site
cp backup.tar.gz /var/
cd /var
tar zxf backup.tar.gz
- Extract files to "/var/jenkins_home
Open "http://[where Jenkins is located]/safeRestart" in your browser
- Jenkins is restarted when the URL is accessed
If possible, it is recommended that both the source and destination versions of Jenkins be up-to-date.
If you get an error about xml 1.1 after restarting
In some cases, after restarting, you may get an error about the xml version. (This has actually happened).
If this happens, don't panic, just open "config.xml" in the Jenkins home directory, modify "1.1" in <?xml version='1.1' encoding='UTF-8'?>
to "1.0" and start Jenkins again, as described in the following article.
https://teratail.com/questions/114431