1. Home
  2. Training Library
  3. Jenkins CICD - Intro

Install Jenkins - EC2 Ubuntu

play-arrow
Start course
Overview
DifficultyIntermediate
Duration1h 47m
Students56
Ratings
5/5
star star star star star

Description

Introduction

This training course introduces you to Jenkins, a popular open source tool used to perform Continuous Integration and Continuous Delivery.

We spend time early on reviewing the key Jenkins features and associated terminology. We then take you through a deep dive in configuring Jenkins to perform automated builds using the Jenkins web administration console in hands on demonstrations, ensuring that you become familiarised with Jenkins and how to administer it. We’ll demonstrate features such as:

  • Installing and setting up Jenkins
  • Creating and configuring pipelines manually
  • Creating and configuring pipelines using a Jenkinsfile
  • Configuring Jenkins pipelines using the Blue Ocean interface
  • Defining build execution environments using docker containers
  • Triggering build pipelines, manually and automatically
  • Navigating downstream and upstream build projects
  • Connecting to version control repositories such as GitHub
  • Setting up build pipelines for Java based projects using Gradle
  • Recording artifacts and test results
  • Setting up and scaling out Jenkins with multiple build agents and executors using SSH

Learning Objectives

What you'll learn:

  • The basic principles of build automation as implemented within Jenkins and how should be a applied to manage and maintain building, testing, and deploying your own enterprise software projects
  • How to install, setup, and configure Jenkins pipelines
  • The key differences between Jenkins declarative and scripted pipelines
  • How to manage build artifacts and test results
  • How to scale out Jenkins using Master and Build Agent setups using SSH
  • The benefits of codifying pipeline build instructions using a Jenkinsfile
  • How to leverage Docker containers within a Jenkins pipeline to provide additional build isolation and flexibility
  • How to install and use the newer more modern pipeline centric BlueOcean user interface
  • How to integrate and leverage 3rd party build tools like Gradle, Maven, Yarn, Webpack, and many more within a Jenkins pipeline

Demonstration

This training course provides many hands on demonstrations where you will observe first hand how to use Jenkins to build and release different types of software projects, for example:

  • Building a front end application which has been developed using the React Javascript framework, using technologies such as Webpack and Yarn
  • Building a back end application developed using Java, Gradle, and Docker, requiring Jenkins to compile the source code, packaging it into a WebArchive file, and then finally releasing it into a Tomcat based Docker image complete with Splunk based instrumentation for logging and monitoring

Prerequisites

  • A basic understanding of CICD, or Continuous Integration and Continuous Delivery
  • A basic understanding of software development and the software development life cycle
  • A basic understanding of version control and associated workflows

Intended Audience

  • Software Build and Release Engineers
  • Software Developers
  • DevOps Practitioners

Transcript

- [Instructor] Okay, welcome back! In this demonstration, we're going to install and set up an automation server using Jenkins. 

Jenkins can be found by navigating to http://www.jenkins.io. In this example, we're going to use the AWS Cloud and launch an EC2 instance using Ubuntu as the operating system, onto which we'll then install Jenkins. So the first thing we'll do is launch our instance. I'm going to use Ubuntu Server 18.04. And for instance size, I'm going to select t3.medium. I'm going to place it in a existing VPC. And for demonstration purposes, I'm going to assign it an auto public IP. In a real world production scenario, you would launch this Jenkins automation server on a private network, only accessible by the developers who need it. But for demonstration purposes here, I'm launching it with a public IP to make it easier and faster for this demonstration. Next, I'll increase the root volume size to 20 gig. I'll tag it, JenkinsDemo. 

Next, I'll attach an existing security group that'll allow me to have SSH access to it. Finally, I'll launch the instance. Okay, so our JenkinsDemo EC2 instance is now up and running. Let's go ahead and connect to it using SSH. So I'll copy the auto assigned public IP address, and I'll swap over into the terminal. And I'll do ssh -v for verbose -i. Let's specify the private key. ubuntu is the username. Click yes. And we're in. So the first thing we'll do is, we'll jump into root. And now we'll do apt-get update to update the local packages. The next thing we need to do is install a Java SDK. In this case, I'm going to use the open JDK version eight. This is required by Jenkins to run as Jenkins is itself developed in Java. So we run apt-get install openjdk-8- jdk. And yes to install. Okay, that's completed. 

We can test it now by doing java -version. And here you can see we've got openjdk version 1.8. Excellent. Okay, the next thing we'll do is, we'll use wget to download the Jenkins package key for authentication purposes. And we'll pipe it through to apt-key add. We can now download the Jenkins package and add it to our sources. And, finally, we follow up by doing another apt-get update. Okay, so at this stage, we are now ready to actually do the Jenkins install. So we do apt-get install jenkins and yes to install. Excellent. So now we can run systemctl status jenkins to see if the service has been installed. In this case we can see that, indeed, it has, and that the service itself is up and running, as per the active message here. We can also do a ps -ef, pipe it, and then grep for jenkins. And here we can see the Jenkins processes. Because we're using Ubuntu, Ubuntu comes with a firewall service called the Uncomplicated Firewall service or UFW. So it pays to have a look at the service to see if it's up and running. So we do so by running ufw status. And here we can see that the Uncomplicated Firewall is indeed inactive and not turned on. If it was turned on, what we would need to do is run ufw allow 8080 for the weird console port that Jenkins uses. 

Okay, so the final thing we'll do before we jump back into our browser is to cut out the initial admin password, which is stored in the var/lib/jenkins /secrets /intialAdminPassword file. So we'll copy this, and we need this to complete the installation when we jump back into our web browser, which we'll do now. Okay, so again, using the auto assigned public IP, we'll browse to port 8080. We'll copy the initial admin password again, and we then unlock Jenkins by pasting it here and clicking the continue button. We're then presented with the Customize Jenkins screen. We'll simply install the suggested plugins by clicking the Install suggested plugins button. In the background, Jenkins now downloads and installs a set of default plugins. This typically takes a couple of minutes to complete. The next thing we do is set up a default admin user. So we'll call ours Admin and we'll set the password. Confirming the password. We'll set the full name to be myself. We then click the Save and Continue button. Under Instance Configuration, we accept the default for Jenkins URL, and click the Save and Finish button. 

And that completes the Jenkins installation. So at this stage we are ready to start building our automation pipelines.

About the Author

Students9918
Labs26
Courses61
Learning paths14

Jeremy is the DevOps Content Lead at Cloud Academy where he specializes in developing technical training documentation for DevOps.

He has a strong background in software engineering, and has been coding with various languages, frameworks, and systems for the past 20+ years. In recent times, Jeremy has been focused on DevOps, Cloud, Security, and Machine Learning.

Jeremy holds professional certifications for both the AWS and GCP cloud platforms.