How to Install and Configure Jenkins? | Jenkins Tutorials | Part II
Aug 16, 2023
How to Install and Configure Jenkins? | Jenkins Tutorials | Part II
This video explains how to install and Configure Jenkins using a WAR file. Learn more: https://accounts.lambdatest.com/regis … #jenkins #automation #javascript This is Part II of the Jenkins LambdaTest Tutorial series wherein Moss(@tech_with_moss), a DevOps engineer, explains Jenkins, practically showcasing Jenkins installation, its configuration using a WAR file. It will help you learn how to run Jenkins from a web application resource file ( a WAR file), Jenkins as a docker container from a docker image, and install Jenkins on Windows using a Windows executable file. Also, you can install it on Mac OS, installing it on many Linux distributions such as Redhat or Ubuntu. In this video, you will be running Jenkins from a WAR file because the WAR file is an operating system independent platform. You will also learn 🎫 -: 🔸What is Jenkins, and how do you configure it? 🔸How to manually install Jenkins? 🔸How to install and configure Jenkins? 🔸How to start Jenkins from the WAR file? 🔸Where is Jenkins WAR file? 🔸How to install Jenkins on Windows 10? 🔸How to install and configure Jenkins in Mac/Linux/Ubuntu? Vɪᴅᴇᴏ Cʜᴀᴘᴛᴇʀꜱ 👀 ➤ 00:00 Introduction to Jenkins Tutorial for Beginners ➤ 00:14 Different methods to install and configure Jenkins ➤ 00:38 Why run Jenkins using WAR file ➤ 00:59 Prerequisites to install Jenkins using WAR file ➤ 01:16 Steps to install Jenkins using WAR file ➤ 07:00 How to create a Jenkins Job? ➤ 11:08 About Jenkins page Complete Playlist 🚩 ◾ What is Jenkins, and Why is it used? | Jenkins Tutorial | Part I https://bit.ly/3fzh1il ◾ How to Install and Configure Jenkins? | Jenkins Tutorial | Part IIhttps://bit.ly/2VZhNhl ◾ How To Install Maven Plugin | Jenkins Tutorial | Part IIIhttps://bit.ly/38CcOqh ◾ Jenkins Github Integration | Jenkins Tutorial | Part IVhttps://bit.ly/3skqHSJ ◾ Creating Jenkins Job For Maven Project | Jenkins Tutorial | Part V https://bit.ly/3g6mflN ◾ How To Add Jenkins Controller \u0026 Agent Node for Windows | Jenkins Tutorial | Part VI https://bit.ly/3yPowZZ ◾Add a Jenkins controller and Jenkins agent node in azure | Jenkins Tutorial | Part VIIhttps://bit.ly/37IOx14 ◾Jenkins Pipeline Tutorial | Jenkins Tutorial | Part VIIIhttps://bit.ly/3iUVP8B ◾Cross Browser Testing With LambdaTest Jenkins Plugin | Jenkins Tutorial | Part IX https://bit.ly/3jUH4ln The above Jenkins tutorial for beginners for testing covers the Jenkins introduction, Jenkins basics, what is Jenkins and how it works, installation, configuration on a local machine (via maven plugin), Jenkins and GitHub integration, scheduling Jenkins, creating Jenkins job for a maven project, Jenkins controller and Jenkins agent nodes for the distributed build, Jenkins pipelines, automated cross-browser testing, Jenkins pipeline (using LambdaTest), and much more insights on Jenkins for beginners. Blogs -: ◾ What is Jenkins used for? https://bit.ly/3tJ2Bkz ◾ How To Set Jenkins Pipeline Environment Variables? https://bit.ly/2VFRM6K ◾ Comprehensive Guide To Jenkins Declarative Pipeline [With Examples] https://bit.ly/3jJDBpI ◾ How To Create \u0026 Run A Job In Jenkins Using Jenkins Freestyle Project? https://bit.ly/3COPFyG ◾ How To Set Up Continuous Integration With Git and Jenkins? https://bit.ly/3xBuk7N ◾ Best Jenkins Pipeline Tutorial For Beginners [Examples] https://bit.ly/3fTihwW Learning Hub - Jenkins Tutorial https://bit.ly/3vaaPT2 What else? �� + Test website on 2000+ mobile and desktop browser environments over cloud + Scalable Selenium Grid for Manual \u0026 Automation testing + 100 min. free automated testing + Free live interactive sessions + 10 Responsive Testing across 56 Device configurations in a single click 🆆🅷🆈 🅲🅷🅾🅾🆂🅴 🆄🆂? ◼ Free Sign-Up ◼ No Credit Card Needed ◼ 24/7 Chat Support ◼ Cancel Anytime Any Queries? -: [email protected] NEED TO KNOW 🎬 RECENT VIDEOS: https://bit.ly/3kUUeAQ 🎓 LEARN MORE: https://bit.ly/3fr6l4Z 🎥 BUSINESS SOLUTIONS: https://bit.ly/2TB7pvD 🚀 WEBINARS: https://bit.ly/37i41co 🛠️ PRODUCT UPDATES: https://bit.ly/3717NGO 💬 CERTIFICATIONS: https://bit.ly/3x4EtcY 📢 FREE For Limited Time Only 🕑, Enroll Now! �� SOCIAL 📝 BLOG: https://bit.ly/3yGVsUc 👥 COMMUNITY: https://bit.ly/3Aiz5oO 🔴 NEWSLETTER: https://bit.ly/3juhxzc 🖼️ GITHUB: https://bit.ly/3jowfYs 🛠️ YOUTUBE: https://bit.ly/3rH2Yfh 🌎 LINKEDIN: https://bit.ly/3xA6F84 👥 FACEBOOK: https://bit.ly/37mbQOa 🐦 TWITTER: https://bit.ly/3Cn0g3A 📸 PINTEREST: https://bit.ly/2VCXI05 Disclaimer: This video features materials protected by the Fair Use guidelines of Section 107 of the Copyright Act. All rights reserved to © 2021 LambdaTest. Any illegal reproduction of this content will result in immediate legal action
Content
5.44 -> hey what's up everybody my name is moss and
welcome back to our tutorial series on jenkins
10.32 -> in this video we're going to be covering how to
install and configure jenkins there are multiple
15.52 -> installation methods for installing jenkins you
can run jenkins from a web application resource
20.56 -> file also known as a war file you can also run
jenkins as a docker container from a docker image
26.64 -> you can install jenkins on windows using a
windows executable file you can also install
31.28 -> it on mac os and finally you can install it on
many linux distributions such as red hat or ubuntu
38.48 -> in this video we're going to be running jenkins
from a war file and the reason that we're going
42.56 -> to be running jenkins from a war file is because
the war file is platform and operating system
47.76 -> independent whether you're following this tutorial
from a mac or a windows or a linux machine
53.52 -> you'll be able to run jenkins from a war file
using the same steps that i'll be taking the only
59.04 -> requirement is that you have a supported version
of the java runtime environment installed on your
64.64 -> machine jenkins supports java versions 8 and
11. java versions 9 10 and 12 are not supported
72.64 -> now that we've covered the necessary details let's
go ahead and get started with the installation
78.96 -> okay so the first thing that i want to do is just
verify that i have java installed on my machine
84.32 -> and to do that i'm going to
open up a terminal session
88.16 -> and in my terminal window i'm
going to type in java version
92.88 -> and you can see in the output of this command
that i have the open jdk version 11 installed on
97.6 -> my machine so if you don't have java installed
on your machine you'll want to make sure that
102.48 -> you go ahead and install either version 8 or
version 11 of either the jdk or the java runtime
109.92 -> environment before proceeding with the tutorial
so now that i've verified the version of java
115.04 -> that's installed on my machine i'm going to open
up my browser and i'm going to search for jenkins
123.84 -> in in the first link jenkins.io i'm
going to select the download link
130.64 -> and in the download page i'm going to scroll
down to where i see the generic java package
136 -> which is the war file and i'm going to go ahead
and download this package and click save file
145.28 -> and i'm going to open the containing folder and
i'm going to move this jenkins.war file into
153.76 -> my home directory if you would like to run jenkins
from a different directory that's fine i'm just
161.12 -> going to put it in my home directory for my own
convenience now that i have the war file in the
166.48 -> home directory i'm going to navigate back to
my terminal window and in my terminal window
172.72 -> i'm already inside of my home directory so if i do
an ls i can see the jenkins.war file is in direct
179.92 -> in the directory and all i need to do to
start jenkins is uh invoke java pass in the
190.72 -> dash jar option and then the name of the war file
so we're going to say jenkins.war and that will
199.04 -> start the jenkins server and this command is
blocking so it's not going to return back to
205.6 -> the command line as long as jenkins is running
and jenkins by default is going to be running
212.08 -> unless we were to specify in the in the invocation
to java pass in parameters to the program
220.72 -> uh jenkins will by default start running on
localhost port 8080 so if we navigate to localhost
230.72 -> port 8080 what we should see is the startup
menu with jenkins and sure enough we see the
238.32 -> first the first startup page for jenkins is to
unlock jenkins so in order to proceed we have to
248.88 -> secure the initial admin password which is
provided to us in the output of the java command
256.08 -> when we start up the jenkins server so you'll
notice here it says please use the following
260.8 -> password to proceed to installation so all i need
to do is just copy that password and this password
268.56 -> is also located inside of this directory so
dot jenkins secrets initial admin password
277.52 -> so i have that copied i'll select continue
and then on the next page we can customize
285.76 -> jenkins to some extent using plugins so as
it says here plugins extend jenkins with
292.56 -> additional features to support different needs
and it's best to install the suggested plugins
299.52 -> if we wanted to we could select a subset of
plugins ourselves but in our case we'll just
305.6 -> select the suggested plugins so jenkins is now
installing all of the uh most popular plugins
313.68 -> that are available uh with jenkins and a couple
i'd like to point out here is the pipeline plugin
321.2 -> which we will use in this tutorial series the
git plugin which will install git on this jenkins
328.64 -> server and will allow jenkins to communicate to
source code management systems that are using git
344.96 -> okay so now that the plugins have been
installed we can create our first admin user
349.68 -> and the first admin user that i'm going to
create the username is just going to be moss
358.64 -> i'll type in a password here and for the
full name i'll just continue with moss
364.24 -> and then i'll enter an email address here
369.76 -> okay and then i'll click save and
continue now if we wanted to change
375.6 -> our uh our instance configuration and select
a different jenkins url we could do so here
382.08 -> i'm going to leave it as the default localhost
8080 and i'm going to select save and finish
389.6 -> and then i click start using jenkins and we
should be brought to the jenkins dashboard
396.72 -> so now we're at the jenkins homepage and i'd
like to get you familiar with the jenkins ui
401.92 -> and introduce you to some key components
of the jenkins interface so to facilitate
408 -> automation tasks jenkins has what
are known as jobs or jenkins jobs
414.08 -> and anytime you need to perform a task using
jenkins you need to create a jenkins job
420.24 -> and there are various types of jenkins jobs that
you can create and those jobs are listed under the
427.12 -> new item page here so let's go ahead and navigate
to the new item page so on this page we can create
433.44 -> a new item in jenkins and we can provide a
name for that item we can say test job here
442.4 -> and after we provide a name we can select what
kind of a job or what kind of an item this is
451.12 -> and the first option that we have is a freestyle
project and a freestyle project is really for
458.24 -> simple uh software development workflows it's for
simple projects and code bases where you might
466.32 -> not have a large number of steps to build and test
your software the next item is pipeline jobs and
474.72 -> pipeline jobs are good for more complex software
development workflows workflows that include
480.96 -> uh build tests and deployment steps but also
might include building multiple code bases
488.8 -> rather than just a single code base or a single
repository and one of the benefits of the pipeline
494.56 -> jobs is that we can store these complex steps as
code and we can write a file called a jenkins file
502.08 -> and that jenkins file will outline all of these
steps that we need to take in our software
507.6 -> development workflow in order to build test and
deploy our software product and later on in this
514.24 -> tutorial series we'll have a dedicated video
covering pipelines and how to create a pipeline
520.24 -> job the next item are multi-configuration projects
and these jobs are meant for pipelines targeting
527.6 -> multiple baselines or multiple platforms so for
instance you might offer a software product like
533.6 -> a mobile app but that mobile app is offered on
not only android but also ios then you need to
540.8 -> uh then you need to have a software development
workflow that includes testing on both
545.52 -> ios platforms and android platforms and this
multi-configuration project would help you
550.96 -> do that the next item in the list technically
isn't a job it's simply a container that stores
558 -> other items it could be a nested folder
or it could be a job inside of a folder
563.04 -> it's a way of grouping jobs into a directory like
structure the next item is the github organization
571.04 -> item and i'm not sure why it shows up twice
here but the github organization item comes
576.8 -> from the github branch source plugin
and this plugin allows jenkins to scan
582.8 -> a github user accounts repositories or a
github organization's repositories in github
590.48 -> and for each repository in the organization or
the user account that contains a jenkins file
599.04 -> jenkins will automatically create a job for that
repository and the plugin will also scan branches
605.76 -> of a github repository and for each branch that
contains a jenkins file it will also create a
612.08 -> dedicated job for that jenkins file and for the
last item here the multi-branch pipeline job
618.96 -> it's somewhat similar to the github organization
because it allows you to define a code base which
626.96 -> might not be located in github maybe it's located
in gitlab or another source code management system
634.4 -> for instance and when you set the code base that
you want this job to scan it will scan each of
642.56 -> the branches in that code base and for every
branch that has a jenkins file in it it will
648.56 -> automatically create a jenkins job dedicated to
that branch so now that we're somewhat familiar
654.72 -> with the types of jobs that we can create in
jenkins let's navigate back to the dashboard
661.12 -> and the next key component of the jenkins
interface that you should be familiar with is
666.24 -> the manage jenkins page so in the manage jenkins
page we can control just about every aspect in
673.2 -> every configuration there is associated with our
jenkins instance so let's go ahead and take a
678.96 -> look at what's contained inside of this page so
in the first section of the manage jenkins page
685.52 -> we have the system configuration and under system
configuration we can select configure system
693.76 -> the configure system page is the central place
where you can update the configuration of jenkins
698.72 -> and you can also update the configuration of
plugins as well on this page so one configuration
704.48 -> here that is worth noting is the number of
executors and you can see here that the number
709.36 -> of executors is set to 2. when a jenkins job is
ran we call a running instance of a jenkins job a
717.84 -> build so a jenkins job can produce a build and in
order for a build to execute it needs an executor
725.92 -> an executor is essentially a thread that can
execute the instructions outlined in a particular
732.4 -> build right now i've configured this jenkins
instance with two executors which means that i can
739.04 -> have up to two builds running in parallel so it
could be two builds of the same job or it could be
747.2 -> one build for one job and another build for
a different job but i can have a maximum of
754.08 -> two builds running in parallel so if i
were to increase the number of executors to
759.68 -> you know like 50 then i would have essentially 50
available threads that i could schedule builds on
766.64 -> and i could have up to 50 jobs running in
parallel now do you want to set the number
771.36 -> of executors that high probably probably not
unless you have a large amount of resources
778.4 -> when i say resources i mean cpu and
memory and and disk space as well
785.52 -> because as you increase the number of executors
you're also potentially increasing the resource
793.04 -> usage that's happening on your jenkins
instance so you need to be very careful
796.8 -> with this configuration setting and in my
case i'm going to leave it at two another
802.48 -> configuration that's also worth pointing out is
the home directory or the jenkins home directory
807.6 -> which right now is in home moss and then dot the
dot jenkins folder the dot jenkins folder contains
815.6 -> all of the data related to this particular jenkins
instance it contains all the jobs metadata the
823.36 -> the artifacts of particular builds and if
i were to delete this dot jenkins folder
830.96 -> i'm essentially blasting this jenkins
instance away all of the all of the data
836.8 -> associated with this jenkins instance would be
gone and if i were to delete that dot jenkins
842 -> folder and then rerun that java command to start
jenkins it would essentially be a fresh jenkins
849.12 -> instance and as i scroll down in the configure
system page you'll see other settings like the
855.04 -> jenkins where jenkins is located in the jenkins
url but you'll also see configurations for
864.72 -> particular plugins for instance the github plugin
which allows me to add github servers these might
870.8 -> be the github server out on the public internet
github.com or it could be an on-premise instance
877.28 -> of a github server you know on your inter
internal corporate network so let's navigate
883.68 -> back to the manage jenkins page and then we'll
navigate to the global tool configuration page
890.88 -> and the tool configuration page allows us to
specify installations or versions of tools
896.96 -> that we would need in order to build and test our
code inside of a jenkins job so for instance we
902.8 -> can specify a particular version of the jdk to be
installed and we can even add multiple versions of
909.04 -> the jdk so that we can compile java code inside of
a jenkins job and we can also specify a particular
916.96 -> git installation so that jenkins can clone down a
code base and build a particular code base from a
924.48 -> source code management system that's using
git and there's other tools as well that we
929.6 -> can add installations for like gradle and and
maven so coming back to the manage jenkins page
938.56 -> under system configuration we can also manage
plugins that are installed on jenkins so from
944.56 -> the manage plugins page we can update plugins
we can see uh what plugins are installed on the
951.12 -> machine and we can also search for plugins that
are not installed uh and there are hundreds of
958.24 -> plugins that extend jenkins functionality
that we can install through this uh through
963.84 -> this page so let's navigate back to the manage
jenkins page and then under the security section
971.12 -> i'm going to select configure global security
and on this page we can specify the method by
978 -> which users would authenticate to this jenkins
instance and in our case jenkins is using its own
986.32 -> user database to authenticate users and right now
in this database there are only two users there's
991.84 -> the admin user and then there's one other admin
user called moss which i'm currently signed in as
998.8 -> and these two users exist inside of this
jenkins owned database now we can utilize
1007.28 -> other methods of authentication for instance if
this jenkins instance was inside of a corporate
1013.28 -> network that utilized ldap we could also integrate
this jenkins instance into the the ldap service
1021.6 -> in our corporate network in addition to
configuring an authentication method we can also
1027.12 -> select a an authorization strategy
like matrix-based security which will
1034.8 -> allow us to define more granular authorization
levels inside of our jenkins instance
1042.96 -> now let's navigate back to the manage jenkins
page and under the security section we also have
1050.16 -> manage credentials and the manage credentials page
allows us to store credentials that jenkins might
1056.64 -> need in order to to communicate with various
services during a particular jenkins build
1062.64 -> for instance when a jenkins build starts it
typically has to clone down a code base from
1067.12 -> a source code management system and in order to
do so it has to authenticate with the source code
1072.48 -> management system and oftentimes it'll do so using
an ssh key pair and you can store the private key
1080.88 -> of the ssh key pair in this manage credentials
section of jenkins so that when the build runs
1087.68 -> it will reference the private key stored in in the
manage credentials page in order to authenticate
1094.88 -> with the source code management system and clone
down the repository to the local jenkins workspace
1100.48 -> and from the security section you can also create
delete and modify users that are able to log into
1106.32 -> the jenkins instance and from the manage jenkins
page we can also monitor the jenkins instance
1111.92 -> uh using the pages listed under status information
we can look at the system log we can also
1118.56 -> review the resource utilization
like cpu and memory that the jenkins
1124.96 -> server is using on this particular machine and
we can also perform administrative tasks like
1132.64 -> restarting the jenkins instance or shutting the
jenkins instance down so hopefully you're a little
1138.16 -> more comfortable now navigating the jenkins
interface and in the next video we're going
1143.28 -> to install and configure the maven plug-in so i'll
see you in the next video and thanks for watching
1149.76 -> if you'd like to learn more be sure to follow
our blog at lambdatest.com forward slash blog
1155.12 -> as well as our lambda test community
at community.lambdatest.com you can
1160.8 -> also earn resume worthy lambda test selenium
certifications at lambdatest.com forward slash
1166.4 -> certifications you
Source: https://www.youtube.com/watch?v=8Qzp9KhvCkM