Jenkins on Raspberry Pi 4

Written by:

UPDATE (24/04/2020): I've stopped using Jenkins on Raspberry Pi 4. It's heavy and was consuming lots of resource and being slow. I've switched to using GoCD on another machine that's always on in my environment.

In my last post I got Gitea working on my Rasberry Pi 4. That’s going to let me hold my source code in a nice revision controlled system locally. I’m also going to need Jenkins to do some automation and CI/CD work. I plan on using my Windows or MacBook Pro to actually code while having the services/apps deployed on the Pi. Here’s how I got it working on it.

There’s no real magic here, but I thought I’d write down what I did for future reference and anyone else looking.

First let’s make sure we have a JDK installed:

root@raspberrypi:~# java --version

This should return something like the following:

openjdk 11.0.6 2020-01-14
OpenJDK Runtime Environment (build 11.0.6+10-post-Raspbian-1deb10u1)
OpenJDK Server VM (build 11.0.6+10-post-Raspbian-1deb10u1, mixed mode)

Looks like we’re all good. Some like to run Oracle JDK but to be honest, these days, why bother unless there’s some specific performance feature you need. As we’re not going to be doing any hardcore Java development, Open JDK is going to be find for us. Now it’s time to get the Jenkins repo added to our Pi.

Let’s make sure we’re all up to date:

sudo apt-get update && sudo apt-get upgrade

That couplet will update your apt sources and pull down any upgrades pending. Do check what updates you have instead of just accepting all. Most of the time nothing will break – most of the time!

We now need to get the repo key installed onto our system:

wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -

That should print out:

OK

Anything else and you’ll have to debug what’s going on. Ping me if you’re stuck.

Now let’s add the repo itself to our system:

sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'

The above should be run all on one line, don’t break it up. Now let’s update again.

sudo apt-get update

Once that’s done you can install Jenkins:

sudo apt-get install jenkins

When that’s complete you will have Jenkins running at

http://YOU_PI_IP_ADDRESS:8080/

Going there will ask you for an administrator password. When Jenkins gets installed in write a unique password to a local file. You can find that by doing this:

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

That’s a one time password and will allow you to move through the installation process and setup as required. Remember to set an Administrator account.

Jenkins is a powerful tool so make sure to use the following resources and starting points to your learning journey:

Hope this has helped. Next up setting up NodeJs and friends on the Pi.

One response to “Jenkins on Raspberry Pi 4”

  1. NodeJS on Raspberry Pi 4 – Khushil’s Thoughts Avatar
    NodeJS on Raspberry Pi 4 – Khushil’s Thoughts

    […] Previous […]

    Like