How To Install Jenkins on Ubuntu 18.04

Jenkins – automation software

Jenkins is an automation server, that automates repeating tasks that is used in continuous integration and development.

It can also be used as an advanced crontab that send you an e-mail whenever a jobs has failed with a log from the console output.

It can pull code from a repository and trigger every thime there is a new release or it can be triggered by a push from github or other kinds of systems that can use webhooks

Its very userfriendly to setup and use.

This guide describe how to install it on a brand new Ubuntu 18.04 instance.


sudo apt install default-jre


wget -q -O - | sudo apt-key add -

sudo sh -c 'echo deb binary/ \
> /etc/apt/sources.list.d/jenkins.list'

sudo apt update

sudo apt install jenkins

sudo systemctl enable jenkins

sudo systemctl start jenkins


Start your browser and go to the url where jenkins is running


You should see a Jenkins screen that asks for a generated install password

Go to you terminal and type this to get the password

sudo cat /var/lib/jenkins/secrets/initialAdminPassword


If you have the needs to give Jenkins access to execute commands as root trough sudo then the solution to is to add this line in the /etc/sudoers file


zfs snapshot script with timestamp

I have created a small simple snapshot ruby script that create a timestamp for each snapshot

#!/usr/bin/env ruby
servername = ARGV[1]
tank = ARGV[0]
require 'date'
t =
t = t.strftime("%d-%m-%y")
cmd = "zfs snapshot " + tank + "/" + servername + "@snap-" + t
puts "taking snapshot of " + servername + " " + cmd
exec (cmd)

Here is an example of how to use it in your /etc/crontab

05 5 * * * root /root/scripts/snapshot.rb backup rasp1 >/dev/null 2>&1

It makes a snapshot of /backup/rasp1 on a daily basis

How to upgrade Debian 8 (Jessie) to 9 (stretch)

If you have an old Debian Jessie you would like to have upgraded to Debian Stretch then here is what i did to make it happend.

First take a snapshot of your filesystems, just to be safe….

Run the commands below, you may have to do some minor cleanup in your /apt/sources.d directory, there can be some duplicate entries with the name jessie in it.
sed -i 's/jessie/stretch/g' /etc/apt/sources.list 
apt-get update 
apt-get upgrade 
apt-get dist-upgrade 
apt-get autoremove 
apt-get clean apt-get dist-upgrade -f 

Raspberry Pi | apt not working – segmentation fault

If you are experiencing segmentation fault on an apt update like this

peter@rasp1:~ $ sudo apt update
Get:1 jessie InRelease [22.9 kB]
Get:2 jessie InRelease [14.9 kB]
Get:3 jessie/main armhf Packages [9,536 kB]
Get:4 jessie/main armhf Packages [171 kB]
E: Method gzip has died unexpectedly!
E: Sub-process gzip received a segmentation fault.
E: Method /usr/lib/apt/methods/gzip did not start correctly

Then it can be resolved by sudo apt-get install –reinstall apt

peter@rasp1:~ $ sudo apt-get install --reinstall apt
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
Need to get 0 B/1,067 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 38419 files and directories currently installed.)
Preparing to unpack .../apt_1. ...
Unpacking apt ( over ( ...
Processing triggers for man-db (2.7.5-1~bpo8+1) ...
Setting up apt ( ...
Processing triggers for libc-bin (2.19-18+deb8u10) ...

After update and reinstall you will be able to do an sudo apt-update end a sudo apt-upgrade

peter@rasp1:~ $ sudo apt update
Hit jessie InRelease
Hit jessie InRelease
Get:1 jessie/main armhf Packages [9,536 kB]
Get:2 jessie/main armhf Packages [171 kB]
Hit jessie/ui armhf Packages
Ign jessie/main Translation-en_GB
Ign jessie/main Translation-en
Ign jessie/ui Translation-en_GB
Get:3 jessie/contrib armhf Packages [43.3 kB]
Ign jessie/ui Translation-en
Get:4 jessie/non-free armhf Packages [84.2 kB]
Get:5 jessie/rpi armhf Packages [1,356 B]
Ign jessie/contrib Translation-en_GB
Ign jessie/contrib Translation-en
Ign jessie/main Translation-en_GB
Ign jessie/main Translation-en
Ign jessie/non-free Translation-en_GB
Ign jessie/non-free Translation-en
Ign jessie/rpi Translation-en_GB
Ign jessie/rpi Translation-en
Fetched 8,692 kB in 20s (417 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
49 packages can be upgraded. Run 'apt list --upgradable' to see them.