Book Image

Jenkins Essentials - Second Edition

By : Mitesh Soni
Book Image

Jenkins Essentials - Second Edition

By: Mitesh Soni

Overview of this book

<p>In agile development practices, developers need to integrate their work frequently to fix bugs or to create a new feature or functionality. Jenkins is used specifically for Continuous Integration, helping to enforce the principles of agile development. This book focuses on the latest and stable release of Jenkins (2.5 and later), featuring the latest features, such as Pipeline as Code, the new setup experience, and the improved UI. With the all-new Pipeline as Code feature, you will be able to build simple or advanced pipelines easily and rapidly, hence improving your teams' productivity.</p> <p>This book begins by tackling the installation of the necessary software dependencies and libraries you'll need to perform Continuous Integration for a Java application. From there, you'll integrate code repositories, applications, and build tools for the implementation of Continuous Integration.</p> <p>Finally, you will also learn how to automate your deployment on cloud platforms such as AWS and Microsoft Azure, along with a few advanced testing techniques.</p>
Table of Contents (17 chapters)
Title Page
Credits
About the Author
About the Reviewers
www.PacktPub.com
Customer Feedback
Dedication
Preface

Installation of Jenkins 2


Let's start with Jenkins 2.x installation. Go to https://jenkins.io/ and click on the Download button to download packages for installation of Jenkins:

At https://jenkins.io/download/, we get two sections. One is for Long-term Support (LTS) that is selected after every 12 weeks from regular releases as the stable release from that duration.

Another section is Weekly release, which has bug fixes and is made available to users and developers.

We will use the Generic Java Package (.war) file in our installation of Jenkins as shown in the following screenshot.

The reason for selecting the .war file for the Jenkins installation is its ease of use across operating systems. Jenkins is written in Java, and in any case, to execute Jenkins we need the latest Java version installed on our system. For Jenkins Installation, Java 8 is recommended. It is recommended to have 1-GB of memory.

Verify the Java installation by using the java -version command in the command prompt or terminal based on the operating system.

Download Generic Java Package (.war) from https://jenkins.io/download/ on the local system as follows:

Before we start Jenkins, we will set the JENKINS_HOME environment variable. When we install and configure Jenkins, all the files reside in the jenkins directory by default. We often need to change the default location for our convenience. We can do that by setting the JENKINS_HOME environment variable. Follow the following steps:

  1. To set the JENKINS_HOME environment variable in Windows 10, go to Control Panel | All Control Panel Items | System and click on Advanced system settings | Advanced | Environment Variables... Please see the manual for other operating systems to set Environment Variables...:
  1. Click on New. Enter the variable name and location and click OK:
  1. Now our JENKINS_HOME is set so Jenkins will use that directory to store all configuration files.
  2. Open the command prompt or terminal (depending on your operating system) and execute the following command:
Java -jar Jenkins.war
  1. This is a fresh installation of Jenkins, so initial setup is required. Note the password:
  1. Once Jenkins is fully up and running, visit http://localhost:8080 and it will open the Getting Started page to Unlock Jenkins. Give the password we copied from the terminal or go to the location given in the dialog box. Copy the password from there and click on Continue:
  1. Click on Install to see the suggested plugins. If we are behind the proxy, then another dialog box will pop up before this page to provide proxy details:
  1. Wait while all the plugins are installed properly:
  1. Verify the green tick boxes for all the plugins that have been installed successfully:
  1. Once all plugins are installed successfully, create the first admin user and click on Save and Finish:
  1. Click on Start using Jenkins:

In the next section, we will see details of the Jenkins dashboard.