9

How do I update jenkins from a existing jenkins install running as a Linux service without loosing any jobs or config?

IanWatson
  • 1,649
  • 2
  • 27
  • 49

1 Answers1

20

First, you need to find where your jenkins.war file is installed:

locate jenkins.war

On my Centos machine, it's here: /usr/share/jenkins/jenkins.war

Stop the Jenkins service:

service jenkins stop

Next, you can backup the existing jenkins.war file:

cd /usr/share/jenkins
mv jenkins.war jenkins-1.586.war

And to finish, please copy the new jenkins.war file in the same location:

cp jenkins.war /usr/share/jenkins/jenkins.war

Restart the Jenkins service:

service jenkins start

It should work and you should retrieve your Jenkins configuration (which is stored in your Jenkins home folder).

Bruno Lavit
  • 10,184
  • 2
  • 32
  • 38
  • Followed instructions but when issueing service jenkins status I get jenkins dead but pid file exists – IanWatson Feb 25 '15 at 12:26
  • java.io.FileNotFoundException: /var/cache/jenkins/war/META-INF/MANIFEST.MF (Permission denied) Chowning directory to the user jenkins run's as fixed the problem – IanWatson Feb 25 '15 at 12:45
  • When you copied the war file, which Linux account did you use? Jenkins, root or another account? After fixing the permission on your folder, can you confirm that the Jenkins upgrade is OK and that you didn't loose your Jenkins config? – Bruno Lavit Feb 25 '15 at 13:23
  • No config lost, I used the root user. – IanWatson Feb 25 '15 at 14:32
  • OK perfect, may be you can consider my first answer as useful ;) – Bruno Lavit Feb 25 '15 at 16:47
  • I followed these directions but couldn't get Jenkins to start, until I realized it had been installed as an rpm, and all I needed was "sudo yum update jenkins" – Ben Fulton May 26 '17 at 12:46