Facing trouble with Jenkins installation? Check out this tutorial on “How to Install Jenkins” and install Jenkins on your system now!
Jenkins is currently the most popular tool for the purposes of continuous integration and continuous delivery on any reliable platform. You can use Jenkins’ Java capabilities for leveraging the different plugins to automate various operational aspects at the infrastructure level. The implementation of Jenkins has gained prominent recognition in recent times with the introduction of new and innovative functionalities offered by plugins.
However, first of all, you have to identify the procedure to install Jenkins. The following discussion would provide you with a clear impression of the procedures for the installation of Jenkins on Docker in Windows and Mac systems. Docker is considered as the installation platform for this discussion.
Enroll Now: Jenkins Basics Training Course
Know about the Jenkins Releases
The first aspect before we look into how to install Jenkins refers to the release lines of the Jenkins project. The two release lines of the Jenkins project are LTS and weekly. On the basis of the organization’s needs, you can select one over the other. You can find the distribution of both release lines with war files, Docker containers, installers and native packages.
LTS or Long-Term Support releases are selected at an interval of every 12 weeks from the collection of regular releases. LTS releases are the stable release assumed for a specific period. Weekly releases are the ones which are created every week for delivery of bug fixes as well as features to plugin developers and users.
Getting Started with the Installation
Now, let us reflect on the steps to install Jenkins on a single or local machine. It is essential to note that the general operations of Jenkins follow a standalone application model with its own specific process with the in-built Java servlet container/application server. In addition, you should also note before getting started with Jenkins that you can also run Jenkins as a servlet in different Java servlet containers including GlassFish and Apache Tomcat. On the other hand, the instructions to ensure the setup of such installations are ideal for advanced level professionals. The following steps can help you ensure successful installation of Jenkins in various production environments.
Prerequisites for Installation of Jenkins
The most important information in any Jenkins tutorial before explaining the installation process refers to the prerequisites. So, let us find out the basic hardware and software requirements before installing Jenkins.
The hardware requirements to install Jenkins for an individual machine include 256 MB of RAM and 1GB of space on a hard drive. On the other hand, it is essential to note that while running Jenkins as a Docker container, the recommended hard drive space is 1GB. The hardware configuration for the installation of Jenkins in the case of a small team should include over 1 GB of RAM. In addition, the hard drive capacity should also be above 50GB in the case of a small team.
The software requirements for Jenkins installation and setup include references to the web browser, Java and the operating system. In the case of Java requirements, you can find that all the new Jenkins versions imply the following prerequisites.
- Java 8 runtime environments, including support for 32-bit as well as 64-bit versions.
- Jenkins does not support the older versions of Java such as Java 9, Java 10 and Java 12.
The requirements are applicable to all the components of the Jenkins system, including the Jenkins master and CLI agents, other components and all types of agents. Jenkins project uses two JDKs or JREs for performing a full test flow. They are OpenJDK JDK/JRE 8-64 bits and OpenJDK JDK/JRE 11-64 bits. JRE/JDKs from the other vendors are supported on the Jenkins, and you can use them without any obstacles.
Web Browser Compatibility
The next critical aspect to install Jenkins is web browser compatibility. The web browsers supported by Jenkins could be classified into three different categories. First of all, you can find that the first level of web browser qualifying for Jenkins aims at fixing browsers proactively and provides similar user experience across all of them. The second level in the web browser support model of Jenkins’ software requirements refers to the one that accepts patches for fixing issues.
It should also depict the best effort for ensuring at least one way of conducting any action. The final level of web browsers in the support model of Jenkins implies no guarantees. It also clearly implies that Jenkins would accept patches in such browsers only if they are found to be low-risk. Google Chrome, Apple Safari and Mozilla Firefox are the recommended browsers for installation of Jenkins.
Download and Run Jenkins in Docker
Now, you have to get started with the installation process of Jenkins. The first step is to download and run Jenkins in Docker. You can find different Docker images of Jenkins, and the most recommended one is jenkinsci/blueocean image, available in the Docker Hub repository. The image also contains the existing Long-Term Support (LTS) production-ready release of Jenkins. In addition, it also bundles up Blue Ocean plugins distinctively.
Installation of Docker
Now, let us install Docker, the installation platform to install Jenkins. The following process can be applicable for installation of Docker image of Jenkins.
- First of all, you have to open up a terminal window.
- In the next step, you have to create a bridge network in Docker by using the following command.
docker network create jenkins
- Now, you have to create the volumes for sharing Docker client TLS certificates that you would need for connecting to the Docker daemon. In addition, you should also understand that the volumes persist Jenkins data using following commands.
docker volume create jenkins-docker-certs
docker volume create jenkins-data
- If you want to run Docker commands inside Jenkins nodes, then download and run the docker:dind Docker image by using the following command.
docker container run \ --name jenkins-docker \ --rm \ --detach \ --privileged \ --network jenkins \ --network-alias docker \ --env DOCKER_TLS_CERTDIR=/certs \ --volume jenkins-docker-certs:/certs/client \ --volume jenkins-data:/var/jenkins_home \ --publish 2376:2376 \ docker:dind
If the above-mentioned snippet does not work, then you can try the following version in this step of the process to install Jenkins on Windows with Docker platform.
docker container run --name jenkins-docker --rm --detach \ --privileged --network jenkins --network-alias docker \ --env DOCKER_TLS_CERTDIR=/certs \ --volume jenkins-docker-certs:/certs/client \ --volume jenkins-data:/var/jenkins_home \ --publish 2376:2376 docker:dind
- Now, the next step in the process to install Jenkins is to download the ‘jenkinsci/bluwocean’ image. Then, you have to run the image as a Docker container by using the following command.
docker container run \ --name jenkins-blueocean \ --rm \ --detach \ --network jenkins \ --env DOCKER_HOST=tcp://docker:2376 \ --env DOCKER_CERT_PATH=/certs/client \ --env DOCKER_TLS_VERIFY=1 \ --publish 8080:8080 \ --publish 50000:50000 \ --volume jenkins-data:/var/jenkins_home \ --volume jenkins-docker-certs:/certs/client:ro \ jenkinsci/blueocean
You can also use the following snippet if the above-mentioned command does not work.
docker container run --name jenkins-blueocean --rm --detach \ --network jenkins --env DOCKER_HOST=tcp://docker:2376 \ --env DOCKER_CERT_PATH=/certs/client --env DOCKER_TLS_VERIFY=1 \ --volume jenkins-data:/var/jenkins_home \ --volume jenkins-docker-certs:/certs/client:ro \ --publish 8080:8080 --publish 50000:50000 jenkinsci/blueocean
How to Install Jenkins on Windows
If you want to install Jenkins specifically on Windows only, then you can follow a different process. Actually, the Jenkins project facilitates a Linux container image and not a Windows container image. Therefore, users have to ensure that their Docker for Windows installation is configured for running Linux Containers rather than Windows Containers. After switching and retaining the configuration for running Linux Containers, here are the steps for installing Jenkins on Windows.
- Open the command prompt window and create a bridge network in Docker by using the following command.
docker network create jenkins
- Now, you have to create the volumes for sharing Docker client TLS certifications required for connecting to the Docker daemon. It can also help to persist Jenkins data by using the following commands.
docker volume create jenkins-docker-certs
docker volume create jenkins-data
- The next step involves execution of Docker commands inside Jenkins nodes. You can do this by downloading and running the ‘docker:dind’ image through the following command.
docker container run --name jenkins-docker --rm --detach ^ --privileged --network jenkins --network-alias docker ^ --env DOCKER_TLS_CERTDIR=/certs ^ --volume jenkins-docker-certs:/certs/client ^ --volume jenkins-data:/var/jenkins_home ^ docker:dind
- In the final step of the installation of Jenkins on Docker in Windows, you have to download the jenkinsci/blueocean image. Now, you have to run it as a Docker container by using the following command.
docker container run --name jenkins-blueocean --rm --detach ^ --network jenkins --env DOCKER_HOST=tcp://docker:2376 ^ --env DOCKER_CERT_PATH=/certs/client --env DOCKER_TLS_VERIFY=1 ^ --volume jenkins-data:/var/jenkins_home ^ --volume jenkins-docker-certs:/certs/client:ro ^ --publish 8080:8080 --publish 50000:50000 jenkinsci/blueocean
Are You Ready to Install Jenkins?
So, you can easily install Jenkins by following the above-mentioned steps. The information in this discussion can serve as an efficient guide for learning about how to use Jenkins in the initial stages. One of the important things that users should note is that they should follow the post-installation setup wizard of Jenkins.
Most important of all, it is important to focus on the hardware and software requirements in detail before you start installing Jenkins. In addition, it is also important for you to understand the overall functionalities and architecture of Jenkins before installation. If you want to learn more about the installation and setup of Jenkins, then you can get started right now with Jenkins basics training course!