First, Jenkins upgrade
Jenkins develops iterations very quickly, releasing a development version weekly, and the long-term support version is updated every six months (PS: Large version update). Update so frequently, how to upgrade it?
War: Download the new war file and replace the old version of the war file. Reboot.
Binary: Uninstall the old version and install the new version.
Second, backup
First locate the Jenkins_home directory, which is the default path for the hidden files under the home directory of the installation user. Jenkins. If installed with the root user, the path is/root/.jenkins. You only need to back up the Jenkins_home directory. If the jenkins_home path has changed, you can use the
echo $JENKINS _home command to see its path.
Third, migration
Migrating in principle requires only the following steps:
Install Jenkins on the new Jenkins server (don't start Jenkins first)
Stop the Old Jenkins Service and package the $jenkins_home directory on the old Jenkins server upload to the new JENKINS server $jenkins_home directory
Start The Jenkins service on the new server.
Run a project to test whether the migration was successful
because each company's Jenkins configuration is different, the configuration in step a is not the same. Take our company Jinkensi environment as an example to see what we need to do to configure Jenkins.
A, install the configuration ant, MAVEN, JDK, git these tools.
Git needs to install the Git plugin first, as described in the second Jenkins configuration. It is emphasized here that the home directory path of the new Jenkins server is best as the old Jenkins server, as the old Jenkins server's data is imported to the new server due to the old configuration used, So the installation path for these tools will also be the path configured on the old server. Of course, this path can be changed after Jenkins is started.
B, copy settings.xml file
Run a MVN command on the Jenkins server, such as #mvn-v, which will generate a. M2 hidden directory in your home directory
Drwxr-xr-x 3 root root 4096 Apr 12:45. m2
Then copy the/root/.m2/settings.xml file from the old Jenkins server to the corresponding directory of the new Jenkins server.
C, install NVM
Perform the following command installation, Link: HTTPS://GITHUB.COM/CREATIONIX/NVM
curl-o-https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | Bash
or Wget:
wget-qo-https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | Bash
D, Tomcat in Server.xml configuration
Since my old Jenkins was installed in the/usr/local/apache-tomcat-8.0.28/conf/server.xml file created a virtual host, so the new Jenkins server is best consistent, Add the following configuration in the Server.xml file
Old Jenkins the Jenkins.war file path on the server is/app/jenkins, so the new server should also be the same.
E. Change the path to the Jenkins_home directory
The old Jenkins server is/opt/jenkins, and the Jenkins_home path is set to the/opt/jenkins directory when the new Jenkins server is configured. And in
Export the path in the/etc/profile file
Export Java_home=/usr/java/jdk1.8.0_66export classpath=.: $JAVA _home/lib/tools.jar: $JAVA _home/lib/dt.jarexport Jenkins_home=/opt/jenkinsexport Maven_home=/usr/local/apache-maven-3.3.9export ANT_HOME=/usr/local/ Apache-ant-1.9.7export path= $PATH: $JAVA _home/bin: $ANT _home/bin: $MAVEN _home/bin
All the steps above for Jenkins configuration
This article from "Zengestudy" blog, declined reprint!
3. Jenkins upgrade and migration