Reputation: 1121
I have a hudson installed in server's /var/lib/hudson directory. when I access jenkins through URL in my browser,, I see the version 1.411 in the bottom of the page.
Does anybody know how to update Jenkins through command line (CLI). if its possible.
When I go to Manage Jenkins page , it says something like : "New version of Jenkins (1.521) is available for download (changelog)."
I dont feel safe with downloading the new jar and extract that in the server.
Upvotes: 3
Views: 14419
Reputation: 1180
On Red Hat Enterprise Linux release 8.8 I updated Jenkins (and several other none Jenkins packages) by writing:
dnf update
Upvotes: 0
Reputation: 1
Yes we can update the jenkins by CLI. Check which jenkins.rpm is being used
$sudo rpm -q jenkins
in my case it was jenkins-2.119-1.1.noarch. If you don't have jenkins.repo and jenkins key then run following steps
$sudo yum install wget
for installing wget
$sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
$sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
$sudo yum clean metadata
This will remove unused excessive and old metadata
$sudo yum remove jenkins
it will remove jenkins-2.119-1.1.noarch (old version rpm). Go to jenkins official website page and then copy url of rpm you want
$wget https://get.jenkins.io/redhat/jenkins-2.380-1.1.noarch.rpm
Downloaded required jenkins rpm pkg
$ sudo rpm -i jenkins-2.380-1.1.noarch.rpm
Installed new jenkins rpm
$ sudo rpm -qa jenkins
jenkins-2.380-1.1.noarch
$sudo systemctl enable jenkins
$sudo systemctl start jenkins
here you may get this type of error "Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe"for details" for this we have to update the java version we are using to 11 or latest
$sudo yum install fontconfig java-11-openjdk
or
$sudo yum install java-11-openjdk-devel
$sudo update-alternatives --config java
select appropriate version of java
$sudo systemctl start jenkins
Upvotes: 0
Reputation: 425
Since the accepted answer doesn't tell much about upgrading Jenkins by logging into the server itself, I will add how to do that in a server that uses apt package manager.
After logging into the server, type the following command to list down all the packages that are upgradable.
apt list --upgradable
You should get an output like this:
Listing... Done
iproute2/bionic-updates 4.15.0-2ubuntu1.3 amd64 [upgradable from: 4.15.0-2ubuntu1.2] jenkins/binary 2.277.1 all [upgradable from: 2.263.4]
If Jenkins is in the output list, just simply run the upgrade with the following command:
apt upgrade jenkins
Upvotes: 3
Reputation: 21130
Are you referring to the Jenkins CLI, or the CLI on your operating system ? There is no way to update the Jenkins version via the Jenkins CLI.
If you installed Jenkins as a standalone WAR file, all you need to do to upgrade it from the command line is to download the new Jenkins WAR file and replace your current WAR file, then restart Jenkins. It's always a good idea to back up the full contents of your $JENKINS_HOME directory before upgrading.
If you used a native package such as an RPM or DEB, you should use the package manager on your Jenkins server (yum, apt-get etc.) to upgrade Jenkins.
Upvotes: 9