15 May

Installing Jenkins on Raspberry Pi 2

So I’ve always wanted to roll my own home continuous integration (CI) server – I use Jenkins as my main CI at work (having used Atlassian’s Bamboo and the hideousness that is buildbot in the past), so I thought I may as well start there.

I previously tried to get Jenkins running on my Raspberry Pi B+ – but the single core and general slowness of the device just meant it wasn’t feasible. Then, I got a Raspberry Pi 2 (naturally) so I wondered if it was any more capable?

For reference – I’m running stock Raspbian on the device.

First up, lets install Jenkins! I run sudo apt-get install Jenkins, and voilà, Jenkins is installed! I navigate to the default Jenkins port 8080 in a web browser, and it is indeed the Jenkins I know and love have developed Stockholm Syndrome for. But wait – it is a rather old version! It turns out that the default package included in Debian is a much older Jenkins installation. Jenkins has a built in mechanism in the web interface to allow you to update Jenkins from the webpage, I tried this and it spectacularly failed. The crux of the matter is that since I installed Jenkins via sudo apt-get, it has placed the jenkins.war file in a sudo location, such that the web updating method can’t replace the original file.

After reading on the Jenkins website, I noticed they had an alternative solution for installing on ubuntu – since Ubuntu and Raspbian share the same .deb, dpkg and apt-get infrastructure at this point, I just followed the instructions;

wget -q -O - https://jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins

This worked, kinda. Basically because Raspbian already has a method for acquiring the jenkins.war, it didn’t like me installing Jenkins via the new method (said there was a .deb file that conflicted). After some Googling, I found this article which had the command;

sudo dpkg -i --force-overwrite /var/cache/apt/archives/smplayer_0.6.9+svn3595-1ppa1~maverick1_i386.deb

Which I used but replaced the .deb file with the offending jenkins .deb, and it installed ok.

For some reason Jenkins wouldn’t start though, so I manually ran the init service that is installed to /etc/init.d/jenkins and ran it as follows;

sudo /etc/init.d/jenkins start

And it complained that I was using Java 6 instead of the minimum required Java 7. If you use the Linux command update-alternatives, you can do;

$> sudo update-alternatives --list java

You can then use;

$> sudo update-alternatives --config java


Which will ask you to select which java version to by default use – I selected the jdk 8 one.

I then in my browser went to the 8080 port for my Raspberry Pi 2 – and I got the shiny latest version of Jenkins, huzzah!

I’ve not had time to add any actual build jobs yet – but from first impressions, immediately on reboot loading each page takes a good 10 seconds. I ran top on the Pi at the same time and the Java process spikes to 130% of CPU. Once you have loaded the page once, it loads quickly the second time, and this is not being client-side cached, it seems that on the Pi the Jenkins process is doing some form of caching of content which is welcome!

Once I add some actual build jobs that generate output I’ll do a follow up post on how responsive it gets under load.


2 thoughts on “Installing Jenkins on Raspberry Pi 2

Comments are closed.