How To Install Jenkins on CentOS 7

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everybody how are you doing today making sure everything's going along well have you ever been tasked with installing jenkins and you have no where to start you may have gone out and googled how to install jenkins well today this video is going to help you do that now we are doing this live today is december 1st it's 1 pm eastern time and my name is darren pope and we're going to install jenkins today on cintos7 we're also going to create an agent and connect it up to that controller and we'll run a test job at the end just to make sure that it works now the big thing about today is we are going to be doing this installation all by hand in a future video we're going to do it through some different types of automation but today if you weren't using any kind of automation something such as ansible or puppet or chef and you're just getting started trying to understand what to do that's what today's video is about so if you have any questions you can go and put them over in the chat and i'll look over once in a while and we will answer the questions now here's where we're starting let me go ahead and switch over so you can see what's going on here okay what we have is two instances i've got a jenkins instance and an agent one instance now i'm using vagrant boxes i'm running locally on my machine if you wanted to test this with aws gcp azure your choice or even locally within your environment you can do that but today i am just using two local vagrant boxes on my 2015 macbook pro so these aren't very huge they have a gig of ram i believe associated to them but this is what we're going to use okay so let's get started now this is the thing to remember as we're going through this today we're doing everything by hand in a future video we're going to add automation into the mix to simplify this installation okay keep that in mind all right so what we're going to do is we're going to go ahead and log into the jenkins vagrant box so that's actually fairly simple we'll say vagrant ssh jenkins and once we get logged in now this is going to be real time so if there are lags that are going on it's just you'll see basically what real time is now just for reference i am hardwired and i have about 500 meg download speed so if you're doing this in an office environment or in a cloud environment it's probably going to be faster if you're doing this at home across a much lower bandwidth it might be a little bit slower so just for reference i tested my speed today and i'm doing about 500 meg down today all right so now we're logged into our jenkins instance and i'm going to be looking back and forth because i can't remember how to type all of these things but each one of these steps are going to be called out also down in the description of this video after the fact we'll put markers in so you can tell you know what happened when just for your reference okay let's check it out so one of the first things that we're going to do is we're going to install wget because i'm going to need that a little bit later and in this distribution of centos through vagrant wget is not installed by default so we'll get this installed here real quick and okay w gets there now great and the next thing we're going to do i'm going to go ahead and become root now normally you can't do this in real life but if you're just testing this yourself you should be able to do this why am i doing root well there's a few files here that i need oh here let's do that that i'm going to need within the non-vagrant user space so i'm just going to hit go ahead and take care of those now now this first file is part of our limits d now you may be saying what's limits d about well let's let me pull it in here first and then we'll look at what this is now i created the file and i just sort of went past it real quickly we'll take a look at it in just a moment but here are the settings that very first column jenkins is going to be the user that is going to be running our jenkins controller process hard and soft the second column third column core f size no file in proc and then values in the fourth column now where did i get this from i'm going to go ahead and just save this whoops once i get out of edit mode notice we created this file in etsy security limits dot d and then i gave it a name of 30 jenkins.conf now why did i do that well let's take a look and see what's in that directory real quick and then we'll figure out what this file is for notice within this limits d directory there is already a 20-in proc cop file so what i did is i just created a 30-dash so when this gets loaded up this gets loaded up after any files that are there by default so you might want to check your distribution of cintas7 and see if there are any other files in all my time working with centos whether on vagrant whether for real on real vms or on bare metal i normally haven't seen more than this 120 in proc the reason why i named it 30 is so that it gets loaded up after the 20 in proc and also i just named it jenkins just so i know that these settings are specifically for jenkins there's nothing magical about that name it's just the name i chose now where did this come from well let's take a look at it there is a knowledge base article from cloudbees that is called prepare jenkins for support and under this section there are a handful of a b c d and e just some different call outs we'll come back and visit the a in just a few moments but let's look at b and this is u limit settings for linux so if you're doing this on windows obviously you wouldn't do this today's video is about centos 7. and it goes through and talks about the different settings that support has found over the years of what the values should be now these values may change over time based on what's happening again today is december 1st 2020 and so always come back and check this document to see what the latest settings might be they may still be the same they may be different the link to this knowledge based article will be down in the description after the video is done probably a couple hours after so you'll also notice here that it calls out hey let's add these settings to etsy security limits conf while i chose since i know centos 7 supports it i chose to create a new file inside of limits.d that way i'm not modifying the system level file i'm just adding my file in okay so i've added the file in and that's pretty much it the file is there i don't have to do anything else yet in order for it to take effect if i already had a jenkins process running i would have to stop the process and then restart it in order for that to be picked up but for now this is good enough next we're actually going to go ahead and set up firewall d now most of the time if you're just testing things out you probably don't worry about firewall you go ahead and shut it all the way off and just ignore it and in reality that's probably okay but i want you to start thinking a little bit better about okay if i did get this into a situation to where you know i really need to lock it down i don't want you to be surprised then so we're going to take a very very basic look at firewall d and the settings that we're going to use we're not going to go any deeper than that but i just want you to understand that we're only going to have a couple of ports open so what i'm going to do is first off since i am root i am going to go ahead and enable firewall d and then i am going to start it up now if i try to access anything on this box from the outside if i try to ssh to it if i tried to get to any ports if they were running they would all be blocked because right now i can take a look at it from here let's see firewall dash command dash dash list all and right now there are no ports open no protocols no nothing so sort of keep this in mind make a note of it because what we're going to do is we're going to add in some rules and we'll come back and look at this in just a moment all right let's get the first one in now since i'm running a vagrant box and i'm able to actually just directly connect to it this one isn't that big of a deal let me go and clear this whoops i did too many let's clear that again all right so let me grab my first rule here to where i'm going to allow for ssh the second rule is going to get us ready for the default ports for what jenkins is going to use and that's port 8080. now since we've made changes we need to go ahead and reload it so it takes effect and then finally we're going to go ahead and do our i went too far i guess i could have done a control r there we go list all and now we can see that the ports for 22 and 88 8080 are there so our basic firewall d rules are in place and that's all that we're going to do we're not going to spend any more time on firewall d other than just the basics now also in this video today we are not going to put be putting a load balancer or any kind of proxy in front of jenkins no ssl no anything else those are things that you're interested in understanding how to do down in the comments go ahead and leave so not in the chat right now but down in the comments you can add comments there later especially if you're watching this on replay and ask your questions there and we'll talk about other ways you can contact us towards the end of the end of the session all right firewall d is up limits d is up let's go ahead and since i'm also running some vagrant boxes locally my boxes don't know do not know how to talk to each other over tcp so i need to add in a configuration to my etsy host file so we can do things by name this isn't really necessary but you'll see why later why i'm doing this okay so limits d we've got firewall set up we've added in our etsy host entries now let's go ahead and install the jdk now with jenkins we have two choices we could either use jdk8 or we could use jdk 11. now in this video we're going to use jdk 11 however i'm not going to use open jdk which comes available within the normal rpm repositories for centos i'm actually going to use open jdk which means i need to set up a new yum repo in order to pull in the file in order to install openjdk just so you understand where that comes from and again this link will be down below there is official documentation from openg or from adopt open jdk of how to do this for centos now what we have here is going to be again remember today is december 1st at the time of this recording there are very specific ways to do these things there may be new ways of doing these things so if you're watching this at a later date be sure to go back and take a look at this section they may have changed okay instead of having to do a cat and pasting in a bunch of file names here now i can just do x to make it simpler to add in the repository that might be the better way to do it so just because you see it in the video right now go back and check the documentation the link will be below and see if this is still the most correct way to do it but for today as of december 1st 2020 this is the way to do it so what we're going to do is i'm going to flip back over to my shell and let's go ahead and clear this and grab my repo so this is a copy and paste from what we just saw on the documentation and in fact i'm going to verify this i'm going to say cat etsy um repos d adopt open jdk and we can see that everything is as we expected so that's cool now since this is centos 7 and we're going to be using git in order to do some things much later on if you install git from the base centos 7 repositories you're going to get a get that is one point something and not two point something so you have multiple ways of doing or getting the latest version of get the two dot x line the way i'm going to show you is the way that i do it you may not be allowed to do it this way you may end up having to build it from source or you may have a different rpm i'm just going to show you the way that i do it based on ways i've been doing it for a long time and what i'm going to do is i am going to install let me go ahead and clear this out i am going to install an a repo that comes from endpoint so you can see that i'm doing a yum install from packagesendpoint.com and it's using the rel which is fine for this and notice that i'm pulling in the seven if you're using centos eight you don't need to do this and in another video we'll go through a centos eight install but for today this is centos 7. so let's go ahead and get this repository set up and now it's set up for endpoint repo if i was to just do a list again of etsy um repos d i can see i've got my adopt open jdk i've got my endpoint again all good to go while we're doing this let's go ahead and get our repository set up to install jenkins now we haven't installed anything all we're trying to do is get all of our all of our repositories installed so we can go ahead and go once we get get started going here so let's check out jenkins so if you were to go to the jenkins.io site go to download in fact let me go ahead and just walk you through this so you click on download in the upper right hand corner and then if you go down here to centos fedora and red hat then you end up on this page which gives you two pieces of information first off we're going to do the wget remember that we installed wget this is one of the reasons why i did that so i'm going to say wget and it's going to download the jenkins repository file and put it into my etsy yum repos d all right so we're going to do that first whoops if i actually copied and pasted it there we go okay so we do that so that one's ready to go but we also need to go ahead and import in the key for that okay so we're good there and finally i'm going to create a couple of files now we'll come back actually a couple of directories we're going to come back and look at these directories later but i'm just doing it now to get it everything ready for when we do the installation all right so the first one that i'm going to do is i'll go ahead and clear this off i'm creating a temp directory inside of var cache jenkins i will go ahead and say right now that by default java.io.tempdur on centos is going to go to slash temp and just to be a nice neighbor i don't necessarily want my temp files to be written into the system level temp directory so i'm going to override this and then let my temp files be written to this directory that's the purpose of this directory when we get there the second one that i'm doing is something to get us ready for support if you think about that preparing jenkins for support document that we talked about earlier i'm creating a directory now so if i had a heap dump or if i had an umi happen or any other reason why a heap dump would be generated i could have the heat dump be put into this heap dumps directory so these are basically just landing places for files that are temp like for slash temp for real temp stuff or heap dumps that are just something happened i don't want it to go into a system directory because the system directory may be really small and it may not be able to save it off so one of the things that you want to keep in mind especially in this case that in var cash jenkins i need to make sure that that volume is large enough for me to handle scenarios of whatever may be happening with a heap dump now that is that good enough we'll talk more about that in a few moments now depending on your distribution of centos and where where you're getting it from it may already have a get version installed on it now if i type get here it's not installed but what i'm going to do is i'm going to go ahead and just do a yum remove of anything that's get now there's nothing installed on this instance yours may be different so i always recommend since we know that we're going to be installing a 2.x version of git from my endpoint repository i just want to make sure that this is completely emptied out before i try to install that okay now finally we're ready to do the installation okay so let's go and clear this out let's look at what we're installing first off well not first off but here in the section we're installing git we're also installing jenkins now in order for jenkins to run we need a jdk now we're doing adopt open jdk dash 11 so we wanted 11 not eight you could use eight as well but we are using hotspot we are not using j9 i've not tested that i've always stuck with hotspot this is what i'm recommending at least in this video but then we have right here at the end font config now this is a package that's going to be required for adopt open jdk to be used with jenkins so in order to get jenkins running i need adopt open jdk and i also need font config and because we're going to be doing things with git later on we're installing git that's it that's all that we're stalling it all that we are installing okay let's press return notice i've got the dash y so i don't have to answer anything and this will take a couple of minutes and again we're doing this live so you can see this in real time we started at roughly 120 20. you can see the clock in the upper right hand corner right up here so let's sort of see how long this takes now remember my download speeds today are around 500 meg so we're getting adopt open jdk and jenkins coming in right now and we will wait for this to render up again you could have chosen adopt open jdk8 but remember always go with hotspot i know hotspot is tested enough i've never personally tested with j9 so i'm not sure what would happen the other thing too is you always want to make sure that you're getting the right architecture which again if you've used the information that we had for creating the repository it handles all the architecture stuff by using dollar sign base arc and those types of variables okay so adopt open jdk is in place jenkins is still coming down these are two reasonably large files they're not huge we can see adopt open jdk was roughly 186 meg and this jenkins distribution or this specific version of jenkins is coming in at 217. so we'll wait for this to come on down i don't think it will take an extra six minutes but we will see we are at about a minute and a half in right now all right so let's watch this a little bit more again this is real time so there is no way to fast forward through this i want you to understand how long these things can take now if you want to fast forward please feel free to go ahead and fast forward ahead that's your your prerogative when you're watching this later if you're with me live you get to hang out okay so we're at 223 getting closer it should catch up any moment well while we're waiting on that to finish up um if you haven't subscribed to the club beast tv channel uh go ahead and do that check it out if you haven't subscribed before go ahead and click on subscribe ring those bells that'll help us out and also keep you informed of when we do these next live streams okay getting closer a little bit more almost there no song and dance right now just waiting i'm not sure what mirror i'm uh downloading from so it could be just a slower mirror even though i've got 500 maybe the pipe from the mirror isn't that much so you have to keep that in mind adopt open jdk i believe is coming straight from jfrog i don't believe they have a mirroring system but with jenkins i'm not sure which mirror i landed on today we are roughly at about two and a half minutes from the time we did this install getting close this may be if you have control over where you have your repositories you might decide to host your own centos based repo and you bring the file in at some point and then you're just pulling from your local repository that's what i'd recommend if you're going to be installing jenkins a lot that way you're not having to go out and be dependent upon the mirrors that way you've basically just brought the data into your environment and then you can just bring it in when you're ready at a fairly consistent speed i'm slowing down as time goes along wow okay we're at 94 percent we're going at 50k roughly the mirrors i've tested before never got this slow but hey you need to understand what you're what you're getting into here we are roughly at three minutes in just under three minutes download is almost complete we're at 95 percent almost there at least i think we're almost there it looks like we're almost there 95 percent now we're speeding back up we're back up to about 80 75 to 80 instead of down at 30. again if you're watching this on replay you can probably go ahead and fast forward until you see the screen going again if you're live just watch it and then all of a sudden we spike back up to about 115 down from 30 so we're going all across the board here today we're 96 percent almost there almost there okay we're getting there we're getting there back down to 30 back up to 50. we're 97 and we're getting ready to declare victory here in just a second or a minute we are now at almost five minutes in now four and a half again another reason if you know that you're going to need this over and over and over again host it yourself and then that way you can set up your own repository and get consistent download speeds and not be dependent on the mirrors for live installations okay we are almost there i think i've said that a few times haven't i okay we're now at five minutes and 10 seconds from the yum install we're slowing down let's see if we can get it to speed up a little bit more maybe go faster 34. if you're watching the replay probably just go ahead and forward on until you see that move to a hundred we're at 97 percent now we're getting there slowly but surely we are at six minutes from the uninstall my best time on this by the way if you're watching this in real time my best time on this was about three minutes so today i just happened to get associated to a mirror that's being a little um pokey if you will okay so we're almost there we're at 98 once we get this rpm downloaded from that point forward we should be cruising right along we're at 98 getting close to 99. almost there how many times have i said that has anybody kept up with that probably too many times at this point okay we're at 98. now we're speeding back up to like almost 300. the internet can be such a fickle thing okay here we go going back down to 30 but we're at 99 so we're almost there feels very throttle lead right now but we're almost at 260. we're at 99 percent 261 and we are at now almost eight minutes basically just pulling down this rpm today so see how we're doing here cool all right that's all done now let's get into the installation installation started at about 1 30 30. see how the installation process goes and we're done so all in all we were about 8 minutes 20 seconds if you were following along live if you are watching now on replay we're right back around to the next part so what's happened now is we've installed the jdk from adopt open jdk we've installed git and we've installed jenkins we also brought along font config because that's necessary for jenkins to work with adopt open jdk all right all done now when the jenkins rpm was installed there were four files installed let's take a look at those files real quick just so you know what they are the first one that we're going to look at and actually i'm just going to list it is etsy and netd jenkins so this is our control file we also have an etsy sysconfig whoops sysconfig jenkins and we're going to look we're going to go modify that file in just a couple of moments we also have our init d sysconfig we have an etsy log rotate d file which tells us or tells jenkins or tells the logarithm d subsystem how to rotate certain files and finally we have the war file which is an etsy user lib jenkins jenkins war so inside of the rpm file were these four files etsy and netd jenkins etsy sysconfig jenkins etsy log rotate d jenkins and then our user lib jenkins jenkins war file those are the only four files that exist they go into their default locations this is the other thing to think about as well if you're going to do a yum install jenkins you don't have control over where files are installed so if you're not allowed to put files in user lib then you're going to have to do a custom installation which can be a video that maybe some of you may want to see so if you do want to see that go ahead and leave some comments down in the video after you watch this and we'll watch the comments over time and make videos accordingly now the other things that occurred is there were some directories created there was a var log jenkins there were var cash jenkins if you think back before we did the installation we created our own child directories the slot the var cash jenkins temp of our cash jenkins heap dumps well it also created var cash jenkins during this process who would not have created it and then there are a couple of others now just in case you're curious now i'll go ahead and show this but i'm not going to do it live there is a blog post that i will go ahead and put down in the description as well about inspecting and extracting rpm package contents if you've never seen this post before in fact it's over five years old but it's great if you take a look at it what you're going to do is you're going to basically run an rpm to cpio against an rpm file so you would have to download the jenkins rpm file and then you can run it through cpio and it's going to show you information so that's just going to be the files so i just walked you through the four files this is the extract and you can go through all these you can list the files there's a different way to do it but i want to take you down to one section and it's towards the bottom and it's show rpm package pre-install and post install scripts these are important because this is where the user jenkins is created this is where we were talking about setting up directories were created you can see these in the pre and post install scriptlets and i don't remember if there were a pre-uninstall or not but there may be this section is really helpful so you can always do an rpmqp-scripts against the rpm file and see what all is going to happen if you've never looked at this and you need to understand okay well what's really happening when i install the rpm this will really help you out okay enough about that let's go ahead and get back into our setup so we are going to make a modification to our sysconfig file this is config jenkins and we're going to actually make two changes we're going to leave most everything default so our jenkins home directory is going to be var lib jenkins again if you're not allowed to write into slash var because of size or for whatever reason you could modify jenkins home and put it into wherever you want it to be we're not going to go through each of these but i am going to make one change here so the jenkins java options we're going to leave the headless in and i am going to grab off to my side here java io tempter remember we created that var cash jenkins temp notice i have a trailing slash on the end of this that is required for this to work correctly if you forget the trailing slash it tries to put everything into the temp file not a not into the directory now this is the only one that i'm adding but let's go back over to the prepare jenkins for support and let's go to the a section this walks you through what cloud b support has found over time to be good starting points for your settings now again i've got a vagrant vm that's a one gig machine my heap sizes i can't really even set up i can't even set a minimum of 2 gig you typically want 4 gig for production sizes you would set both xms and xms to 4g but then you also have the different gc tuning here and also gc logging all of these things are really important again the link to this knowledge base article is down in the description and i highly recommend you take a look at this and understand what to do again much like what we were talking about looking at adopt open jdks thing you always want to come back to this document because it is kept up to date so if there are any changes that occur over time this is the place to look for them okay one final thing at the very bottom of the file so i just did a shift g to go to the bottom in the jenkins arg parameter i am going to add in a value called dash dash plugin root and then slash var slash cache slash jenkins slash plugins now we have not created this directory this directory will be created when the process starts what this does is instead of inside of your jenkins home directory so in this case var lib jenkins plugins if we didn't set this value here when the plugins get extracted they would be extracted within the jenkins home directory a very loose way to think about it is when a plugin file is extracted think of it like sort of tempter or it's a run time because think about it when a war file is started it's not the war file that's running it's the war file gets extracted and is run what we'll see in a few moments when we start it up is the war file is extracted into a web route under var cash jenkins directory so var cash jenkins webroot we're just saying here hey i want my plugins to be extracted into var cash jenkins plugins so that way everything that's sort of run time like that is being pushed over to var cash jenkins and i'm keeping my jenkins home directory as clean as possible all right so we're going to save this and we're gonna do one final setup because we did the creation of those directories earlier for slash temp and slash heap dumps uh let's go ahead and change the ownership reset the ownership of var cash jenkins just to the jenkins user and the jenkins group now we're ready to go ahead and start jenkins and since it didn't yell at us it's probably okay let's go and take a quick look at the status of the process and i did a dash l status so we could see the full output here you could have done a ps aux whatever you want to do but i wanted to check this here so we can see that the process that's running here has our headless true and temp der temp that we just set inside of sysconfig it also has the dash dash plug-in root that we just set in our sysconfig and we were talking about dash dash webroot here's where that is we don't have to set that that's baked into the init d file it's just that these other things that we added in sysconfig are pulled in and read from the sysconfig file and put in to init d so all of this looks great and if we wanted to check it in fact i'm going to do that real quick we can just take a quick look at the log file and we can see that right now jenkins is fully up and running if you're ever trying to debug an installation a fresh installation and you don't see jenkins is fully up and running then there's another problem and you'll need to go through the logs okay so this is all good for now now what we're going to do is we are going to set up through the ui now again remember today was everything was about manual let me see that is not there we go okay so once you get it up and running then what you should see is a screen like this it says unlock jenkins and you can grab the contents of this file which this is also output to the log file we saw it just a moment ago but let's go ahead and just cat out the contents of that file we'll paste that in for the administrator password again this is randomly generated so if you're seeing this right now that password doesn't mean anything that was unique to my instance we can see that we are installing 249.3 we also saw that during the um install we're going to install suggested plugins that is what i recommend always to do always install suggested plugins there may be a couple maybe like ant and gradle that you don't want you can remove those after the fact but it gets everything else in place that you're going to want now again we're going out and downloading files from the internet these are not bundled in so if i was to take a look at what's happening right now in my log we can see that it's installing these plugins and it's sort of wrapping strength but it says installation successful downloading so it's getting all these plugins so this will take just a moment because everything is downloading from the internet again i don't know what mirror that i'm ending up on so we'll see okay we are waiting for this to complete this should not take as long as what we had with the rpm install but you never know while we're waiting on that get my notes ready for the next section uh again if you're here for the first time uh thanks for hanging out today if you're new to this channel go ahead and subscribe click that subscribe button ring that bell that way you'll be notified anytime there are new videos available for you to watch okay let's see here we're still installing let's flip back over here let's see what's going on okay this is interesting so let's wait and see what happens here yep just paused for a minute and this is a good to see again because i want you to see and understand what happens sometimes in real time sometimes things just wait okay we're getting into pipeline we are almost there now remember don't leave once we get jenkins installed because we still are going to set up an agent and get it connected and we're going to run a test job towards the end but that part will go much faster than what we've been doing here we are almost there progress bar looks good all right now you can do it i have belief in you you can do it there we go last one okay almost there there we go now we can create our first user i'm just going to create a dummy user and i'm going to give it a real but fake email address and click on save and continue it asks us do you want to go ahead and set your jenkins url yes i definitely want to do that because i know that this is going to be my real url we'll save this for a different video for another time but basically this needs to be set to whatever this url needs to be in real life not necessarily a machine name in a local port different video for a different time but for today this is the real one that we're going to use we're going to start using jenkins the very first thing that i do as soon as i get into a jenkins instance as i go in and type slash restart why do i do that before doing anything else it's really simple i just want to make sure that it restarts fine i haven't made any other changes other than just doing the installation i just want to make sure that it will restart for me cleanly now i'm still tailing this log right now and you can see that it's already starting to start back up so that's good so it appears that it's going to be okay this will take up to about a minute again i'm running locally not high powered machine but it's it's running okay now we're back here i will go ahead and log in and we are are we yes we are installed and logged in cool all right so that's that for jenkins now i'm going to come back over here i am going to exit out of my jenkins instance and i am going to log into my agent instance now this one will go much faster now on this agent instance we're going to of course install java because we need java in order to connect the jenkins controller to the agent i'm also going to install maven gradle and docker so but we're going to do these a little bit faster also one more thing we are still going to go ahead and turn on firewall d so for this we are going to do firewall d we're going to start firewall d now this time though the only connection that we're going to allow in is port 22 because that's all that we need to connect we're going to be connecting from our jenkins controller to our agent across ssh so this is going to be the only port that's open i am going to go ahead and reload this and finally i will do a list all just to make sure that we're good and there is 22. great all right one more final thing just sort of prepping for it we also need to set up my host file since i don't have dns here and then i set up the real ip addresses inside my vagrant network okay cool that's that next up we need to install the repo for adopt open jdk we saw this before this is exactly the same as before we're going to need to get so i need to go grab my endpoint repository that's ready to go for endpoint repo we are going to go ahead and remove git nothing there and now finally let's do the installation now the installation for maven gradle and docker are coming up in just a moment we're getting just the basics in so we need adopt open jdk font config i just bring it along because it's there wget we're going to need in a few moments and then get as well let's try this this should go much faster than before we're roughly at starting at 149. let's see how long this goes you can see here that adopt open jdk is moving at about five to six meg per second slowing down a little bit but that's okay we're still above a meg again if there are packages that you're going to be using time and time again you probably want them local local meaning in a repository that you control from a speed perspective okay well in fact let me go ahead and go forward just a little bit and we'll come back and visit this in just a second in order to install docker on the docker documentation the link will be below it tells you how to install docker engine on centos you go through uninstall any old versions we'll do that we are going to set up a docker repository which is the docker ce repository we're going to install the docker engine and then we are going to [Music] start docker but then this is where a lot of people miss we don't want to always have to run sudo docker we just want to be able to run docker as the vagrant user not as a root user so in order to do that we need to follow this linux post install section which this section is true for whether or not you're using centos ubuntu doesn't matter this step is the same so we want to be able to manage docker as a non-root user and we're going to go through and do each of these sections so we'll test all this out in just a few moments but just so you can see from the documentation perspective the link to this will be down below this is how you install docker on centos all right so let's flip back over see if we're done with this hey it's all completed and you know minute minute and a half probably since we were talking about the other things okay now next up and i'm going to go through each of these i'm not going to talk through each of them i'll try to go slow with it whoops got to get in the right place the next section is we're going to remove all the docker things that may be there which none of them are here again we're following all the documentation from installing docker engine on centos i'm going to do a yum install for yemen yum utils which is already there now we're going to set up the repository so now that's done now we're going to unins or we're going to install docker so there's docker ce docker cecli container d io those are exactly the same as what we saw down here c-e-c cli container dio but you'll also notice that i added in unzip i need to unzip later on once i get to maven and gradle so i'm just adding it here okay let's let this run this will not take very long packages are already all downloaded they're all fairly small and what i'm not going to do unlike here where it gets into hey let's start docker in fact i will go ahead and start docker but i'm not going to test it here yet with hello world okay so we're done here i am going to go ahead and grab my notes here i'm going to enable docker i am going to start docker and then i'm going to do an exit so i'm going to get back out to my vagrant user just my normal user i'm going to do a group add docker it already exists i'm going to do a sudo user docker user in fact this these sections from after i typed exit these are coming from the post installation right here's the group ad here's the user mod the reason why i've dropped down is i wanted to say dollar sign user which is vagrant okay now i'm going to type exit i could force it says log out and log back in or i could do a new group whatever but i just log out and log back in and now what i'm going to do is i'm going to do a clear docker run hello world so i can't find it pulls the image and there's the output so i know the docker subsystem is working as i expect okay getting close to the top of the hour we may be able to get it in okay here we go we're going to install maven now i'm doing i'm going to install maven and gradle into opt tools and there's going to be a maven directory in a gradle directory whoops i need to go back up to root because i'm going to assume root is managing this right now so make dur we'll change ownership later if necessary and a cd into that directory i'm going to wget that tarball for maven i'm going to extract the tarball i am going to remove the tarball and then i'm going to set up a sim link this is just old habit you can do this if you want to i just point the latest sim link at whatever the latest version of maven is so that's a you know old-school way of doing things okay maven's done sort of we'll we'll finish it up in just a minute all right let's go and get gradle ready to go we're going to make opt or do a make door on op tools gradle we're going to cd over to that directory we are going to grab that specific version i haven't checked to see if that's the version today or not but it is for now we are going to unzip because they don't offer tar balls that's the reason why we installed an unzip i'm going to get rid of the zip file again remember we're doing everything by hand today on purpose i want you to understand all the pieces that it takes to get to an automation install of this okay there's my latest finally we're going to set up a profile d for both gradle so we get our opt tools gradle latest on the path and we also are going to set one up for maven and finally we are going to change the ownership of opt tools to the vagrant user and that will make more sense in just a few moments so i'm going to exit here i'm going to exit out one more time i'm going to go back in so everything resets and now if i type maven version that's good gradle version and that's good i say docker info and that looks good okay so all of our tools are in place let's flip back over to our controller now notice that we still have two executor slots available on the agent as a best practice the excuse me on the controller as a best practice the controller should not have any local executors so we're going to disable the local executors first so the way that we do that is we'll click on manage jenkins configure system and then we do a little bit of security through obscurity once this renders what we're going to do is we're going to set our number of executors or executors to zero the label for the controller now is going to just be some type of garbage doesn't matter what it is and then i'm going to set the usage to only build jobs with this label expression so i'm sort of covering all bases i'm setting the number of executors to zero but if somebody did something and they bumped it up to a different number they would have to know this label in order to actually be able to use those executors is this a little bit too much yeah probably but it's okay for now let's go and click on save then we'll notice here on the left hand side there are no longer the one and two slots now we have a couple of different ways we could add the node actually there's one way to add the node a couple of different ways you can get there you could do manage jenkins manage nodes in clouds and you get this list that's pretty normal or you could just click on build executor status and it takes you right back to the same page we're going to click on new node the agent no or the node name is agent one again that's just the name it's a permanent agent the only option my home root directory is going to be home vagrant slash jenkins dash agent i never go right into the root of the home directory i always go into a subdirectory of the directory that i'm going to be logging in or the user that i'm logging in as the label is going to be linux i'm only going to use this if i'm matching i tend to always have specific labels i don't have just any generics so i could use an agent any or just give me anything i always want my jobs to be specific where they run is it a little more set up yes but at least i know where things potentially are going to run i could have an age i could have three or four agents all have the same label but at least i know they're only going to end up on those four and no more okay we're going to launch via ssh sort of speeding up here at the end the host is agent one the reason why i can reference it by agent one here is because of the entries that we put into our etsy host file earlier today we're going to add a new credential the username is vagrant and not surprisingly the password is also vagrant and the id i'm going to give it vagrant and description is vagrant the id if you forget to give it an id it's going to generate a grid so a 6-4-6 dash whatever the sequence is always give a good id value because if you need to reference that id it's good to know what that id is i'm going to click on add and i select vagrant and just to be lazy for the moment i'm going to say non-verifying that is not the most secure it would be better to always use known hosts or anything else but non-verifying but for this example non-verifying is fine i'm going to go ahead and click on save again super simple super easy we can see that the agent is launching so if i click on agent one and it's being launched so i can click on the log and we can see that everything is spinning up and it says agent successfully connected and online so if i come back over to nodes i can see that agent one is now online i can see agent one is idle down here all right we're here we're finally here after an hour we are finally here we're going to create a job called test pipeline we're going to select pipeline and click ok and i have a little simple pipeline script if you don't understand pipeline syntax right now that's fine just know the basics here that i'm saying and this is declarative so i'm saying agent label linux remember that our agent one has a label of linux and i've got a single stage and i'm doing a multi-line sh block maven version gradle version docker info the exact same three commands that i ran when i set up that agent this is not you know by by chance the commands that i ran over there are the commands that i want to run here because i know the commands ran before when i was doing it by hand now i want to run the same commands through a job and make sure they work as well so let's go ahead and click on save and we'll click on build now you can see it's running there's maven there's gradle there's docker info and all of the data is exactly the same and that's it that is it in roughly an hour even with some slow internet speeds we were able to install a jenkins controller set up an agent with some very very basic tools connect that agent to the jenkins controller and run a test pipeline to make sure everything works now there's a lot of other things you could do here but those are the basics that get you started so if you're interested in seeing more content like this we can produce more videos in fact we have a few others coming up we've already talked about one of them being how to do this through an automated way to save so i'm not having to do all of these things by hand and it would be able to be reproducible pretty much on demand if you're responsible for maintaining these things having this automated is going to make your life much easier so we're going to actually do that in the next video that's probably going to happen next week if you're watching live if you're watching on replay just go and check to see how to install jenkins on centos 7 using ansible yes we're going to use ansible because it's simple and we're going to keep it simple then we'll be looking into other os's like ubuntu amazon linux maybe there's other ones that you want to take a look at leave comments down below and we'll put those on the list and work through them as we can get them finally this is sort of new for us so if you're wanting to uh contact or you know get in contact with us one way you can do it is through a new twitter handle called cloudbeesdev cloudbeesdevs yep that was it cloudbeastdevs uh so you can reach out to us there or even on my personal twitter is darrenpope and you can also see my name sort of up here in the top right hand corner so hopefully today was helpful for you again if you watch live with us thanks for hanging out with us for the past hour and if you've watched this on replay and you were able to fast forward through things that got a little bit slow that's great again the links for all of these different knowledge base articles and how to do rpm to cpio all those things are down in the description below and from there hopefully you'll be able to understand better when you install jenkins what's that what that is like for you if you have any questions reach out to us on twitter you can make comments down on this video we'll look them up from there thanks for hanging out with us today have a great rest of your day and we will talk with you in the next video you
Info
Channel: CloudBeesTV
Views: 1,571
Rating: undefined out of 5
Keywords: darin pope, jenkins, centos 7, how to install jenkins
Id: g7CnQnDQwuU
Channel Id: undefined
Length: 65min 30sec (3930 seconds)
Published: Tue Dec 01 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.