1 | Jenkins 2023 | Getting Started | Step-by-Step for Beginners

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome I am raghav and in this session I am going to start Jenkins so we are going to learn Jenkins step by step and do not worry if you are a complete beginner and if you have never used Jenkins I will start from scratch and we will go up step by step and whenever you have any questions you can let me know in the comment section so in this session we are going to see what are the prerequisites for using Jenkins we will learn how do we download and install Jenkins we will see how do we access Jenkins from the browser and then we will see how do we set up Jenkins how do we go through the setup Wizard and then how do we do the configuration and then finally we will start by creating our first job on Jenkins then we will see how do we build the job when we say run job it it is building job it is one and the same thing and we will also see how do we check the logs and results of our job execution and then finally we will see how to stop Jenkins so let's get started and let us first see the prerequisites now you can use Jenkins on any operating system that is any computer that is using Windows Linux or Macos operating system so whatever operating system you have either if you have Windows Linux or Mac you can use Jenkins and Jenkins is a Java application and therefore we will need Java on our system so to check Java you can go to your terminal or your command line so if you are on window you can go to command prompt I press the Windows key and I have started typing CMD I can see this command prompt option and when I hit enter or click here I get this command line window opened so here if I say Java space hyphen version and hit enter I can see the Java version and you can see I have jdk 17. so in case you do not find any message like this that means Java is either not installed or not set up on your system in a moment I will tell you how to do that how to set up it but for now let us just first check if Java is there you can also see the Java compiler by checking Java c space hyphen version but it is fine it is Java compiler may not be required but you should have jdk on your system and similarly if you are on a Mac or Linux you can still go to your terminal for example if I'm on my Mac I will go to terminal and this is the command line for mac and again I will check Java space hyphen version to check the version of java and here I have Java 8 or jdk8 so you can check if Java is there also make sure that you have the Java which is compatible with Jenkins and for that you can check the Jenkins Java compatibility if you go to Google and just say Jenkins Java compatibility you can go to this Java requirements page from Jenkins and you can see Jenkins require s Java 11 or 17 and you can also see all the details here so here you can see either you should have GDK GRE 11 or 17 okay you can see all the details here so here just in case you do not have Java or jdk you can go to open jdk and get the jdk folder downloaded I had created a video earlier on this so if you search for uh how to install Java jdk by my name you should get that video so yes this is the one so how to download Java jdk without login to Oracle so this is the video I will also keep a link of this video in the description below so you can check that but just to tell you and show you if you do not have Java or jdk you can go to your browser and say Java jdk download and here it will take you to the Oracle website so if you go to here Java download you will see here this is Oracle and it may require you to create an account and sign in before downloading but here you can also see there is a open jdk so if I go here open jdk it will take you to this website jdk.java.net so you can also directly go to this jdk.java.net and then here you can see all these jdks you can click on any for example if I say jdk 20 and if I go here let me just go and check so it should take me to this page okay it is directly downloading yeah you can press Ctrl or command and then click so it is taking me to this jdk22 but I want 11 or 17. so what you can do is directly on this URL where there is this 22 or whatever number it is you can change this to 17 or 11 and hit enter and you can see here we get this if I say 11 okay I can get here you can see all this also you can see there is a list here so I can directly go to this 17 here and then I can download for this Windows if I'm using Windows or whatever you are using you can download it so if I click here it will start downloading and if I check on my downloads folder so you can see it has downloaded the open jdk17 okay now for Windows you will have to extract this folder and keep it under C program files so if you go to my computer or this PC and go to your C drive and go to program files you will either file find a folder called Java and if you do not find this folder Java you can create a new folder name it Java and under this folder inside this folder you can extract and keep the jdk folder so you can see in my case I have multiple jdk folders we have 11 8 and 17. so if I go to this open jdk 17 you will see the bin folder and all these folders now which Java you have to use if you have more than one jdk folders downloaded you can select whatever you want to use and you will have to give the location of the folder in your environment variables so if you go to my computer or this PC do a right click and go to properties and then here you will find you can go to you can scroll down and go to Advanced system settings and here you will find Environment variables or you can directly just search for press the Windows key and search for start typing environment variables you will see this edit environment variables and click on this and here you can see this is the user variable so this will work for the current user logged into the system for example I am the administrator otherwise if you want to set some variables system wide that means it will be available at the system level and will be available to all the users you can create it here under system variables so you have to create you have to find if there is a variable called Java underscore home already created if not you can create it you can click on new and create a variable called Java underscore home and then in the value of this variable you have to keep the folder of the jdk that you want to use and this folder should be until the location of the bin folder of that particular GDK for example if I have to use this jdk 7 17 I will go until the location where I have this bin folder so this is the location this is the address I will use and you can also check this is what I have used in my Java home and then you can go to the path environment variable if I start typing p a you can see it goes to path edit and then add the location until the bin folder of the jdk folder now you can either copy this entire location until the bin folder and add it to your path environment variable or a better way is I can say here percent Java underscore home percent that means whatever is there in my Java underscore home variable it will be taken here it will be referred here and then backslash bin okay so that means whatever is in your Java home that will be referred and then go to the bin folder so then after doing this you can open a new command line if you use the same command line it will not show you so you can exit from here and open a new command prompt and then check javaspace hyphen version and you will find your Java is set and available now just in case you face any issues you can let me know in the comment section also you can check on my video where I have shown this in detail so this is also for Java and this is the one I had created recently for installing Java jdk without login to Oracle okay so this is Step number one for three requisites you can use any of your operating system it should have Java jdk hit or higher installed and as we checked in our Java requirements for Jenkins 11 or 17 since this particular release okay so in my case I have 70 now step number two will be we will have to go to the Jenkins download link and then download Jenkins so I will go to my browser and I will say Jenkins download and search for it you can see I get this Jenkins dot IO forward slash download page now here you can see all the details you can also see the hardware and software requirements so if I open this link you can check all the requirements for your uh for your particular machine if it satisfies so you can see for Linux you can use all this and this is the RAM and space you can see all these details here Java requirements is also there you can see all the details if you are using Windows you can check all the requirements for Windows we need 256 MB of ram 1GB of this space and this is the minimum requirement and this is the recommended requirement okay So based on your operating system you can check and then if you scroll further down on the download page you can see this is the long term stable release and this is the weekly release so we will go with this stable release and here you can select the operating system or the platform you want to use Java with so we have Mac OS windows we have Docker kubernetes Etc and we also have this generic Java package that is dot War file so this will work everywhere I am going to click on this and this will download the jenkins.war file so you can see it is downloading and if I check my downloads folder as of now it is in progress and yes it is now downloaded here okay so we have got this Jenkins dot War file downloaded okay now after this we have done this step downloaded Jenkins dot what file now we have to access Jenkins so to start Jenkins or access Jenkins we first have to go to the terminal or the command line and then go to the location of the Jenkins dot what file so here I will again open my command line let me open a new command line and this step will remain same for Windows Mac and Linux now here I will first have to change the location to the folder where my jenkins.warf file is now here you can see by default command line opens on C drive and if your jenkins.warf file is also on some folder in the C drive then you can directly just say CD and then give the location for example I'm I will go to this downloads folder so I'll just say CD uh downloads or whatever is the complete path you can give it here and you can see it has changed to Downloads folder but just in case if it is in some other drive for example degree first you have to change the drive so for example it is on D drive I will say d colon and hit enter and now it is on D drive and then I will say CD and then give the location of the D drive wherever my genkis.warfile is but I will come back to my C drive and I am already on my downloads folder now our shortcut on Windows is you can open the folder wherever your jenkins.war file is and then click on this address bar and here say CMD and hit enter you will see command line opens on the same folder and then you can continue with the rest of the command so this is a shortcut for Windows all right so I have come on my downloads folder where my jenkins.war file is and now I will run the command Jenkins a Java hyphen jar jenkins.war so if I say Java hyphen jar and I can press tab now it should auto complete jenkins.war so if I hit enter now it will start Jenkins on the default Port which is 8080 but just in case you want to use a different port for example sometimes port 8080 is not available not free or you just want to start your Jenkins Honor on a different port in that case you can use the command Java hyphen jar jenkins.war until now it is same after that you give a space and say hyphen hyphen this is double hyphen then HTTP Port make sure here it is case sensitive everything here is in lowercase except p p is in uppercase here okay so we say HTTP Port equals whatever port number you want to use for example nine one nine one nine zero nine zero eight five eight five whatever port number you want okay so I will also try this I will say Java hyphen charge and can start War space hyphen hyphen HTTP Port equals let us say 9191 and hit enter so this will now start the Jenkins server and this requires jdk so it will only work if you have the right jdk installed also you can see it gives us the admin password for the first time so you can keep it copied or you can also find it at this location on in the dot Jenkins folder so you can either copy it directly from here or you can go from to this location and then get it from here okay and when you see this message Jenkins is fully up and running that means Jenkins is now ready to be used and then we can go to the browser and go to the link localhost colon whatever Port you have used for example if I have used 9191 here I will say 9191 so it is localhost colon the port reward that we have used to start Jenkins so I will go to my browser and I will say localhost and you can see HTTP also if you want HTTP colon forward slash for forward slash which is optional it will anyways take it then call in the port number and hit enter and this should show you the Jenkins start page all right so here now you have to give the admin password that I have copied from the command line itself or you can also find it at this location make sure this may vary for you so whatever is shown here for you you can go and get the the password from there or you can just copy as I did from the command line and paste it here and say continue now here we have to install some plugins if you click this button which says install suggested plugins it will install some most commonly used plugins on Jenkins and if you want to select yourself you can go here and say select plugins to install so let me show you if you go here select plugins to install you can see all the plugins here and the suggested plugins are already checked so you can see we have some organizational Administration plugins build feature plugins build tool plugins build analysis reporting pipeline source code management user management security notification languages bills Etc so you can either check it and check from here whatever you need or not need and then click on install or I can just go to this install suggested plugins and you can see the progress now uh sometimes you may see that all the plugins installation is failing that may be because of your Java version before recording this video I was trying and I had jdk 11 and when I was trying with the latest version of Jenkins all this was failing but when I changed my jdk to 17 then it started um installing the plugins so you can see if some some plugins fails that is okay so you can wait for some time it can take a minute or two for all the plugins to install also sometimes if you see something stuck here you can go to the command line or terminal where Jenkins is running and just press enter sometimes it is stuck so you can do that also if you press Ctrl C here on the command line it will stop Jenkins so you can see it is as of now doing the plugin installation and do not worry if some plugins are failing I will tell you later how do you get the plugins from Jenkins from the Jenkins dashboard so this is okay if whatever you get here should be fine it will also depend on your network speed So based on your network speed and other configuration it can be slow or fast so some of them have failed which is fine uh if you want you can retry but otherwise you can continue let me just see just check and retry if there is something uh maybe some issue which is fine I'll check this later and anyways we don't need all these plugins we whatever we need we will get it separately and I will show you how you can get it later on with GDK 17 it is passing so that's fine I will continue and now here it is asking us to create the first admin user now if you want you can skip this and continue as admin but in that case every time you start Jenkins you have to use the username as admin and the password as the admin password that we used initially okay the password that was shown on the command line we will always have to use that and we will have to copy that so to keep a simple username and password you can create a admin user okay I need the email address as well it says this is my Jenkins URL which is fine and I will say save and ready to be used and you can now start using Jenkins and here it shows us the Jenkins dashboard so you can see here new item then manage users here see the build history manage and Keynes then views you can see if any job is in queue it will be shown here and how many executors we have it will be shown here and when we create our new jobs all will be shown here so now we have done all this you can if you want you can take a screenshot of this screen keep it handy with you and see it multiple times so you will always remember the starting steps for Jenkins the prerequisites how do we download and install Jenkins and then finally how do we start and access Jenkins these are the three steps now the next steps are to create the first Jenkins job here you can go to the dashboard and click on new item so you can see here is a button new item or if you see this you can also directly click here to create a new job we also have some other options here how to set up agent create configure a cloud Etc but for now we just want to create a job I will click new item and here I will say my first job you can give any meaningful name if you want I will click on freestyle project and say okay and this will take you to the job configuration page okay so here we have done step number two we entered the job name and selected freestyle project and now in the job configuration page we will give more details about our job so here if you want you can give a description about your job then if you scroll down you can also see you can make this job enabled or disabled from here if you scroll down we have section for source code management and you can see as of now it does not have many options but when we add more plugins like plugin for git Etc we will have options here we have built triggers how do you want to trigger this job if you want to schedule it you can check this bill periodically then we have built environment details and then build steps and then post build actions so for now let me just go to build step and here I will I want to run a command in this job so if you are on Windows you can select execute Windows batch command if you are on Mac or Linux you can say execute shell so I'm on Windows I will say execute Windows batch command and here I am just going to run a simple command Echo hello Jenkins okay whatever command I write it will get executed okay this is what I have done I added a build step and I am running the command and step number four will be to save and run the job when we say run the job or build the job it is the same thing so I will say apply and Save and it takes me to this job page where I can run the job you can see build Now button and you will also see the history here so as of now there are no builds I will click this build now and you can see build scheduled you will see the job running here you can see the first build is here so this was very quick so you cannot see the progress bar if you see the progress bar here if the job is running you will see the progress bar below this number one and if you click on the progress bar it will take you to the live locks or the console output so for now I will click on this number one which is the first run of this job and this will take me to the details the time date Etc how much time it took and then if I want to check the console output I will click here console output and you can see it printed hello Jenkins and it is successful that's why it is shown in green if there is any problem it will be in red if I go here and I will have a drop down where I can see all these details for this particular run I can see the console output changes delete built number one Etc so I can do this also if I go to my first job and click on this drop down I have options to go to the workspace will now configure delete delete rename Etc okay now if I go back to my channels dashboard you can see the job here my first job last success last failure last duration I can also run it directly from here and I can see all the options for the job whatever I can do I have the options here and for this particular build I have the options to go to the output console output delete changes Etc okay so let me run it again from here and you will see the second run of this particular job so it should uh refresh automatically after some time but if you want you can also refresh it and then you can see we have got the second build for this particular job and everything is successful as of now okay so we have done step number five as well we have checked the results and we have also seen the console output and then uh if you go to manage Jenkins from the dashboard if you go to this manage Jenkins you will see uh there are some errors for getting the plugins which is fine which we already know and here here if I go to configuration you can see here the home directory we call it Jenkins home as well or the home directory of Jenkins and you will see a DOT Jenkins folder and the path may vary for you for me it is see users administrator.jenkins so if I go to this location C users administrator and you can see this folder dot Jenkins in case it is hidden you can enable viewing of hidden folders on your system and then you can check this and if you go inside you can see this folder contains all our logs all the documentation all the configuration all the jobs so for example if I go to jobs folder you can see my first job and all its configuration and all the details so this is kind of everything that you do on your Jenkins is stored here so in case you delete this folder everything that you have your jobs configuration everything will be gone so this is the home directory and this is how you can check it here all right now if you want to stop Jenkins because I started Jenkins from running the jenkins.war file which is running on this command prompt all right so I can just go here and I can close this or press Ctrl C and then stop it as press Ctrl C and now you can see it is stopped here if I now go to my Jenkins on the browser and if I now try to access it you can see it will not be accessible okay So based on whatever way you have used to start Jenkins accordingly you can stop it as well all right so I hope this was very useful in the coming sessions we will learn more about Jenkins we will go step by step and whenever you face any questions you can let me know it will be very easy and very interesting I will see you soon thank you for watching and never stop learning
Info
Channel: Automation Step by Step
Views: 27,181
Rating: undefined out of 5
Keywords: Learn Jenkins for beginners in 2023, Step-by-step tutorial on how to install Jenkins, jenkins hands-on class, online jenkins free tutorials
Id: cy2257Y7I54
Channel Id: undefined
Length: 31min 37sec (1897 seconds)
Published: Thu Aug 31 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.