how to install jenkins on raspberry pi

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 that is not available in the Raspberry Pi OS repository. To install it, a new repository must be added, as well as the Java JDK.

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

If you’re 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?

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.

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:

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now
  • 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:

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

Join Our Community!

Connect, learn, and grow with other Raspberry Pi enthusiasts. Support RaspberryTips and enjoy an ad-free reading experience. Get exclusive monthly video tutorials and many other benefits.

Learn more

Are you a bit lost in the Linux command line? Check this article first for the most important commands to remember and a free downloadable cheat sheet so you can 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.
    If you are using Bookworm, you can install OpenJDK 17 with:
    sudo apt install openjdk-17-jdk -y

    On older releases, version 11 should be available:
    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, with the corresponding version you just installed:
    openjdk version "17.0.10" 2024-01-16
    OpenJDK Runtime Environment (build 17.0.10+7-Debian-1deb12u1)
    OpenJDK 64-Bit Server VM (build 17.0.10+7-Debian-1deb12u1, 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.

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:
    sudo wget -O /usr/share/keyrings/jenkins-keyring.asc https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
  • Add the new repository URL to your apt sources
    echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
    https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
    /etc/apt/sources.list.d/jenkins.list > /dev/null
  • Update the apt cache
    sudo apt update

    You should see the Jenkins repositories during the 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:
  • 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
  • You can now use Jenkins like on 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.

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now
  • 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.

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:

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:

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 > 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.

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.

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

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.

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

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

Reminder: Remember that all the members of my community get access to this website without ads, exclusive courses and much more. You can become part of this community for as little as $5 per month & get all the benefits immediately.

Conclusion

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 🙂

Whenever you’re ready, here are other ways I can help you:

The RaspberryTips Community: If you want to hang out with me and other Raspberry Pi fans, you can join the community. I share exclusive tutorials and behind-the-scenes content there. Premium members can also visit the website without ads.

Master your Raspberry Pi in 30 days: 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 multiple projects with step-by-step guides.

The Raspberry Pi Bootcamp: Understand everything about the Raspberry Pi, stop searching for help all the time, and finally enjoy completing your projects.

Master Python on Raspberry Pi: Create, understand, and improve any Python script for your Raspberry Pi. Learn the essentials step-by-step without losing time understanding useless concepts.

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

Similar Posts