How to update Jenkins/Hudson through CLI - jenkins

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.

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.

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

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

Related

Install valgrind on ubi8-minimal docker image

I want to install valgrind on a docker container based on ubi-8 minimal image. The problem is the tool doesn't seem to be available in any packages on the microdnf repository. I tried with gcc-toolset-11-valgrind, gcc-toolset-11-gcc-11, gcc-toolset-11-gcc-c++, gcc-toolset-11-runtime, etc to see if the tool is available in any package. There should be a package available for normal rpm: gcc-toolset-11-perftools, but it isn't available.
I also tried to download valgrind by hand and execute from a volume but the dependencies are not available. Is there a easier way to get running valgrind on a ubi8-minimal docker container?
Using rpm in combination with already download packages I finally managed to install valgrind, the process was:
download valgrind package and dependencies with yum in the host machine
yum install --downloadonly --downloaddir=./valgrindDownload gcc-toolset-11-valgrind
Find out missing dependencies (gcc-toolset-11-runtime-11, and perl)
Install local packages using rpm:
rpm --install ./valgrindDownload/gcc-toolset-11-valgrind-3.17.0-6.el8.x86_64.rpm
Find out valgrind instalation directory
In my case was under /opt/rh/gcc-toolset-11/root/usr/bin/valgrind
Finally run the full command:
sudo docker run -v `pwd`:/home/<container-dir> <docker-image>:<version> /bin/bash -c "microdnf install gcc-toolset-11-runtime-11.1-1.el8.x86_64 && microdnf install perl-5.26.3-421.el8.x86_64 && rpm --install ./valgrindDownload/gcc-toolset-11-valgrind-3.17.0-6.el8.x86_64.rpm && /opt/rh/gcc-toolset-11/root/usr/bin/valgrind --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind-out.txt command <arguments>"
Doing so, the valgrind output gets redirected to valgrind-out.txt

How to install docker correctly in ubuntu 22.04 is it possible at this time?

I am following the docker installation tutorial in ubuntu: https://docs.docker.com/desktop/linux/install/ubuntu/
And when I try this step: sudo apt install ./docker-desktop-4.8.1-amd64.deb I am getting the next error: E: Unsupported file ./docker-desktop-4.8.1-amd64.deb given on commandline
Not sure what that means or if I am missing something.
E: Unsupported file ./docker-desktop-4.8.1-amd64.deb given on commandline
I also tried with:
curl https://desktop-stage.docker.com/linux/main/amd64/74134/docker-desktop.deb --output docker-desktop.deb
sudo apt install ./docker-desktop.deb
And got the error:
E: Invalid archive signature
E: Internal error, could not locate member control.tar{.zst,.lz4,.gz,.xz,.bz2,.lzma,}
E: Could not read meta data from /home/rodolfo/docker-desktop.deb
E: The package lists or status file could not be parsed or opened.
Any ideas?
According to official documentation, and the steps I followed to install docker in Ubuntu 22.04 LTS
Visit the following site https://docs.docker.com/engine/install/ubuntu/
Scroll down until you find the Install using the convenience script section.
You will find the following commands:
$ curl -fsSL https://get.docker.com -o get-docker.sh
$ DRY_RUN=1 sh ./get-docker.sh
the first command will install a shell script with the all needed commands and the other will run this shell script.
You can test the installation by running these commands
$ sudo docker --version
$ sudo docker info
If it looks fine, you now have docker in your machine.
Optional step is to download docker desktop for Ubuntu 22.04
https://docs.docker.com/desktop/linux/install/
MAKE SURE You already installed docker engine before installing docker desktop for Ubuntu
Try moving the DEB file to HOME folder or Change the directory in terminal to the folder where the file is downloaded
So I had the same problem and the solution was to go to the folder root that I downloaded the deb file in it wish is Downloads for me and I rerun the commend
My issue ended up being Ubuntu 22.04 was installed with wsl version 1.
wsl -l -v
NAME STATE VERSION
Ubuntu-22.04 Running 1
wsl --set-version Ubuntu-22.04 2

docker Error with pre-create check: "We support Virtualbox starting with version 5

I'm trying to create docker machine host using the following command in fedora OS version 25.
docker-machine create -driver=virtualbox host01
I get below error while executing the command.
Error with pre-create check: "We support Virtualbox starting with version 5. Your VirtualBox install is \"WARNING:
The vboxdrv kernel module is not loaded.
Either there is no module available for the current kernel (4.10.12-200.fc25.x86_64) or it failed to load.
Please try load the kernel module by executing as root
dnf install akmod-VirtualBox kernel-devel-4.10.12-200.fc25.x86_64 akmods --kernels 4.10.12-200.fc25.x86_64 && systemctl restart systemd-modules-load.service
You will not be able to start VMs until this problem is fixed.\\n5.1.26r117224\".
Please upgrade at https://www.virtualbox.org"
I have already virtualbox latest version installed. Running the command suggested by
sudo dnf install akmod-VirtualBox kernel-devel-4.10.12-200.fc25.x86_64 akmods --kernels 4.10.12-200.fc25.x86_64 && systemctl restart systemd-modules-load.service
I got the below error
Last metadata expiration check: 0:48:35 ago on Thu Aug 17 22:38:47 2017.
Package akmods-0.5.6-7.fc25.noarch is already installed, skipping.
No package --kernels available.
No package 4.10.12-200.fc25.x86_64 available.
Any suggestions?
I also had this problem and for this I upgrade Virtual box to 5.2 using following commands. This link help me
sudo apt-get remove virtualbox virtualbox-5.1
sudo sh -c 'echo "deb http://download.virtualbox.org/virtualbox/debian xenial contrib" >> /etc/apt/sources.list.d/virtualbox.list'
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
sudo apt-get update
sudo apt-get install virtualbox-5.2
Hope this helps.
For windows users, in 2022 such problem still exists. So for those who use last build (now it is virtualBox-6.1.32-149290-Win), try to use version that starts with prefix 5. But not all '5' versions work. For example, for me worked only version 5.2.42 while versions: 5.2.18, 5.2.20, 5.2.44 didn't work
Helped for win 11 x64

What is the docker daemon version on Vagrant provisioner?

I am trying to understand which is the version that Vagrant installs on its VM (my specific case: using box ubuntu/trusty64) if a Docker provisioner is selected.
In particular, I would like it to be a fixed version since it has to reflect my staging environment.
Unfortunately, in the documentation of the provisioner nothing is mentioned about which version of the Docker daemon will be installed. Same by searching for my question, either on google or on github issues.
Can somebody point me to the right directions/docs?
Basically vagrant will try to install the latest version available from the repo. You can review in the source code
machine.communicate.tap do |comm|
comm.sudo("apt-get update -qq -y")
comm.sudo("apt-get install -qq -y --force-yes curl apt-transport-https")
comm.sudo("apt-get purge -qq -y lxc-docker* || true")
comm.sudo("curl -sSL https://get.docker.com/ | sh")
end
If you prefer to have a specific version installed you would need to run a shell provisioner before your docker provisioner (provisioner are run in order) and install the version you want to work with

Yum install / update not working inside docker images but working otherwise from the centos machine

I am able to yum install, or yum update from the server, but when trying to do same (as specified in the Dockerfile) inside a docker container, it fails stating the following common error :
One of the configured repositories failed (Unknown),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Run the command with the repository temporarily disabled
yum --disablerepo=<repoid> ...
4. Disable the repository permanently, so yum won't use it by default. Yum
will then just ignore the repository until you permanently enable it
again or use --enablerepo for temporary usage:
yum-config-manager --disable <repoid>
or
subscription-manager repos --disable=<repoid>
5. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:
yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true
Cannot find a valid baseurl for repo: base/7/x86_64
my Docker file is a simple :
FROM centos:centos7
RUN echo "nameserver 8.8.8.8" > /etc/resolv.conf
RUN echo "nameserver 8.8.4.4" >> /etc/resolv.conf
RUN yum -y update; yum clean all
RUN yum -y install epel-release; yum clean all
RUN yum -y install python-pip; yum clean all
I have tried various things like adding ip_resolve=4 in /etc/yum.conf, or addinf 8.8.8.8 and 4.4.4.4 to /etc/resolv.conf and other methods, in vain.
here's the docker info :
Containers: 28
Running: 0
Paused: 0
Stopped: 28
Images: 144
Server Version: 1.13.0
docker-compose version 1.10.1, build b252738
docker-py version: 2.0.2
CPython version: 2.7.5
OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
Please help. I am only running things under a VPN, no proxy.
machine is an AMI : 3.10.0-514.el7.x86_64.
Need I add it's IP anywhere insde docker container? Please help.
TIA!

Resources