How to install Jenkins server on your Raspberry Pi?


If you are a serious developer, you might be looking for tools to make your life easier and your applications more reliable. Jenkins is one solution you can use to build and test your software projects, and the good news is that it can be installed on Raspberry Pi.

Jenkins is an automation server which is not available in the Raspberry Pi OS repository. To install it, a new repository need to be added, it also required the Java JDK to works.

Don’t worry, I’ll show you step-by-step how to do this on your Raspberry Pi in this tutorial. I’ll start by an introduction and we’ll quickly move to the installation and configuration.

If you are looking to quickly progress on Raspberry Pi, you can check out my e-book here. It’s a 30-day challenge, where you learn one new thing every day until you become a Raspberry Pi expert. The first third of the book teaches you the basics, but the following chapters include projects you can try on your own.

What is Jenkins?

x
Best retro-gaming solution
Get My Cheat Sheet!
Grab your free PDF file with all the commands you need to know on Raspberry Pi!

Introduction

Jenkins is an open-source automation server.
It helps developer teams in building, testing, deploying and automating any project.

You can enjoy the 1000+ available plugins to adapt Jenkins to your environment.
For example, you can integrate it with GitHub, LDAP or add email notifications.

Raspberry Pi Bootcamp
Sale: 10% off today.
Take it to the next level.
I'm here to help you get started on Raspberry Pi.
Learn all the skills you need in the correct order.

Features

The Jenkins project puts the following qualities forward on its home page:

  • Continuous Integration and Continuous Delivery: You can tune your Jenkins server to a simple CI Server, or to integrate in real time any change the developer team made on the public hub
  • Easy Installation: as you’ll see in the next paragraph, Jenkins is easy to install on any platform, and Raspberry Pi is perfect for this
  • Easy Configuration: you can change everything from the web interface
  • Plugins: like I already mentioned in the introduction, there are hundreds of plugins available to fit your needs
  • Extensible: this goes along with the previous point, but you can easily improve Jenkins with all the available free plugins

Video

To see Jenkins in action, you can check this demonstration video:

Jenkins’s installation guide

Now let’s dive into the Jenkins installation steps, it’s easy with all the commands below.

Here are the required steps to install Jenkins on Raspberry Pi:

  • Install and update Raspberry Pi OS.
  • Install Java.
  • Add the Jenkins repository and install the corresponding package.
  • Unlock the access to the web interface to configure it.

Install Raspberry Pi OS

The first thing you need is a working Raspberry Pi OS installation.
You can start with Raspberry Pi OS Lite, it’s OK because you don’t need a GUI for Jenkins, everything is available on the web interface.

If you already have any Raspberry Pi OS installed on your Raspberry, it’s fine, follow this installation guide with it.
If not, you need to install Raspberry Pi OS on it, and you can follow this Raspberry Pi OS installation guide if you need help to do this.

In any case, make sure you have:

  • Internet working (ping google.com)
  • Updated your system:
    sudo apt update
    sudo apt upgrade
  • Enabled an SSH access:
    sudo service ssh start
  • Taken note of the Raspberry Pi IP Address
    ifconfig

When everything is correct, you can move to the next paragraph.

A bit lost in the Linux command line? Check this article first, which will give you the most important commands to remember, and a free cheat sheet you can download to have the commands at your fingertips.

Prerequisites: install java

Jenkins needs Java to run the server.
So, you need to install Java JDK before everything else:

  • Install the Java SDK from the apt repository
    sudo apt install openjdk-11-jdk -y
  • After the installation, you can make sure that Java is correctly installed with:
    java -version
  • You should get something like this:
    openjdk version "11.0.12" 2021-07-20
    OpenJDK Runtime Environment (build 11.0.12+7-post-Raspbian-2deb10u1)
    OpenJDK Server VM (build 11.0.12+7-post-Raspbian-2deb10u1, mixed mode)

If you experience any issue with this installation, I have an entire tutorial on how to install any Java version on Raspberry Pi.

Master your Raspberry Pi in 30 days
Sale: 10% off today.
Download the eBook.
Uncover the secrets of the Raspberry Pi in a 30 days challenge.
Learn useful Linux skills and practice multiples projects.

Install Jenkins

Then, to install Jenkins on your Raspberry Pi, you need to add a new repository (to get the latest version):

  • Download the repository key:
    wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
  • Add the new repository URL to your apt sources
    sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
  • Update the apt cache
    sudo apt update
  • And finally install Jenkins
    sudo apt install jenkins
    This step will install Jenkins, create a Jenkins user to run the daemon, and create default configuration and log files.
    This will also install the web interface we’ll enable in the next paragraph.

Unlock Jenkins

After the installation, Jenkins is immediately available on http://IP_ADDRESS:8080.
But on your first try, you’ll get an “error screen” indicating that Jenkins is locked:

This is a security measure to avoid anyone accessing the configuration interface before the administrator can configure it. Follow these steps to unlock the access:

  • Display the content of the file in red on your Raspberry Pi:
    sudo cat /var/lib/jenkins/secrets/initialAdminPassword
  • You’ll see a password, something like:
    jenkins admin password
  • Copy this password and paste in the field from the Jenkins page
  • The following page I got is the “Offline” page.
    It’s probably a bug on my side, but if needed you can configure a proxy to get an Internet access, or skip the plugins installation.
  • If everything works fine, you should get a page that asks you to install basic plugins.

    Install them and wait a few minutes for the installation to finish.
  • Then move to the next page, to create your first administrator user.
  • Fill the form with the credentials you want to use, and click next.
  • Finally, the interface shows you the main URL and you can save and finish the configuration.
    jenkins ready
  • Click on “Start using Jenkins” to access the main interface
    jenkins main page
  • You can now use Jenkins like any other server.

That’s it, Jenkins is running on your Raspberry Pi, and you can start hosting your projects on it.
Remember that the Raspberry Pi storage is not unlimited, so for big projects it’s probably not a good idea to send everything on the Raspberry Pi. You should at least use an external USB drive to store your projects, even a cheap one (like this one on Amazon) will be way safer than your SD card.

Jenkins configuration

In this section, I’ll give you some tips to configure and monitor your new Jenkins server.

Start and stop the Jenkins service

Jenkins is well integrated with Raspberry Pi OS/Debian, so it’s easy to manage the Jenkins service.
If something goes wrong, you can check the Jenkins service status, or start/stop it, if needed.

  • Check the Jenkins service current status
    sudo service jenkins status
  • Start the service
    sudo service jenkins start
  • Stop the service
    sudo service jenkins stop

Configuration files

Generally, you can do everything from the web interface, so most of the time you don’t need to edit the configuration files.

If for some reason you want to check them, Jenkins stores all files in the /var/lib/jenkins folder.

Master Python on Raspberry Pi
Sale: 10% off today.
Get the eBook.
Do more with your Raspberry Pi, learn the useful concepts and take the shortcuts.
You miss half of the fun of using a Raspberry Pi if you don’t know anything about Python.

Log files

Jenkins also uses the default /var/log folder to save logs files.
You can check the /var/log/jenkins/ directory for the latest logs.
But you can also read them from the web interface.

Other configuration tasks

For anything else, you can check the “Manage Jenkins” entry in the main menu.
You’ll get something like this:

manage jenkins configuration

From there, you can edit everything you want to adapt your configuration to your specific needs.
You can also manage your users from this menu.

Jenkins usage

Finally, I’ll give you here some basic advice to start with Jenkins if you are new with this software.

Install new plugins

The first thing to consider is to install new plugins, especially if you got the “Offline page” during the installation.

Go to Manage Jenkins > Manage plugins.
In my case, I had this error on the page:

There were errors checking the update sites: SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

If you have the same thing, you can go to the “Advanced” tab.
Then in the “Update Site” field, replace https with http in the URL.
Click on Submit, it should be OK now (if not, click “Check updates” on the “Manage plugins” home page).

Finally, go to the “Available” tab and look for the plugins you need to install.
You can use the search engine on the top to filter the list.

You can also check for plugins on the official website, I find it more convenient.

Create a basic project

Now, let’s say you want to create a new project on Jenkins:

  • The first thing to do is to go back to the home page and click “Create new jobs”.
  • Enter a project name and select the project type corresponding to your code.
    If you installed some plugins, you will probably get the choice between projects type (GitHub, Subversion, …)
    If not, start with the “Freestyle Project”.
  • On the next page, you’ll get the project details that you can fill with your information.
    You can for example select the source code management tool (Git or Subversion if installed).
    You can also choose triggers to automatically launch a build.
  • When everything is fine, click on Save to access the workspace.
    You can always go back to the previous configuration form with the “Configure” menu in the left menu.

You can now manage everything with the left menu in your project:

jenkins project menu

Backup your project

Even if you can try to back up the Jenkins folder to keep your projects safe, the best option is to install a backup plugin:

  • Go to Manage Jenkins > Manage plugins.
  • In the available tab, look for “Backup Plugin”.
  • Install it.
  • After the installation, you’ll get a new link in Manage Jenkins : “Backup Manager”.
  • Click on “Setup” and configure it as you want.
    backup jenkins

If you choose a local folder for the backups, don’t forget to copy them elsewhere for more security.

Going further

As everything after your project creation highly depends on what kind of project you want to host on Jenkins, I’ll let you check the official documentation for specific questions.

You can also use different tools to discuss with Jenkins users.
You have everything you need on this page, to find the way you prefer to communicate with them.

Related questions

Is it possible to move Jenkins to another server (hardware) if my Raspberry Pi is full? Yes, you can use the Backup Manager tool I showed you previously to create a full backup, and import it on another server. So, you can try Jenkins on Raspberry Pi and move to something more powerful in a second step.

Is there a way to use Jenkins in a Docker container? Yes, absolutely. It’s even the recommended method for many platforms. You can find all the information on this Docker page.

Conclusion

Get My Cheat Sheet!
Grab your free PDF file with all the commands you need to know on Raspberry Pi!

And that’s it! You know now everything you need to install and configure Jenkins for your Raspberry Pi.
The installation is straightforward, but the usage can be a little tricky at the beginning if you never used Jenkins before.

I’m sure you’ll quickly find what to do with Jenkins on your Raspberry Pi 🙂

If you have any comment, suggestion or just want to chat with us about this tutorial,
you can post your messages in the community on Patreon. See you there!

Raspberry Pi Resources

Not sure where to start?
Understand everything about the Raspberry Pi, stop searching for help all the time, and finally enjoy completing your projects.
Watch the Raspberry Pi Bootcamp course now

Master your Raspberry Pi in 30 days
Don’t want the basic stuff only? If you are looking for the best tips to become an expert on Raspberry Pi, this book is for you. Learn useful Linux skills and practice multiples projects with step-by-step guides.
Download the e-book

VIP Community
If you just want to hang out with me and show your support, you can also join the Patreon community. I share behind-the-scenes content there and give you early access to my content. You’ll also get a shoutout when you join.
More details here

Need help to build something with Python?
Create, understand and improve any Python script for your Raspberry Pi.
Learn the essentials, step-by-step, without losing time understanding useless concepts.
Get the e-book now

You can also find all my recommendations for tools and hardware on this page.


This tutorial doesn't work anymore? Report the issue here, so that I can update it!


Patrick Fromaget

I'm the lead author and owner of RaspberryTips.com. My goal is to help you with your Raspberry Pi problems using detailed guides and tutorials. In real life, I'm a Linux system administrator with a web developer experience.

Recent Posts

Master your Raspberry Pi in 30 days

Download this eBook and discover:
1. Secrets from my 20-years Linux experience 2. Many step-by-step projects for your Raspberry Pi 3. How to save time by learning the right way
DOWNLOAD YOUR COPY
10% OFF FOR A LIMITED TIME WITH THIS LINK
DON'T MISS IT!
close-link
Master your Raspberry Pi - 10% off