Jenkins Installation

Eduonix Learning Solutions
A free video tutorial from Eduonix Learning Solutions
1+ Million Students Worldwide | 200+ Courses
4.0 instructor rating • 244 courses • 1,198,304 students

Learn more from the full course

Learn DevOps with Jenkins All in One Guide

Be a DevOps Guru and master CI and CD with Jenkins

04:19:29 of on-demand video • Updated December 2018

  • Integrate CI and CD in your development process
  • Learn to use Jenkins for process automation
  • Work on a real world project and implement the concepts
  • Learn professional tips and tricks for better Jenkins management
English Hello everyone. Welcome back. This is Ahmed for Eduonix and this is beginning Jenkins. And in this section we are discussing different ways of installing jenkins as we have mentioned in the first lecture of this section. Jenkins is a very very flexible application when it comes to installation and also as you are going to see when it comes to its usage. And the ways you can customize it for your specific needs and for your specific environment. However we are now discussing the installation. In the previous lecture we have seen how we can install Jenkins as a servlet inside tomcat by using the generic java package.war option. Lets see in this lecture how we can use one of those pre compiled files binary files as it's sometimes called. As you can see here Jenkins is very generous in its options. You can install it as a Docker container. You can install this on Docker inside FreebSD, mac, windows, Ubuntu, Redhat variance even Suse all major Linux distributions have a ready made or pre compiled binary file to install Jenkins. In our case on our specific case we're going to use Ubuntu/Debian because I think it's easier to use and it is very common and it has a large support base. So let's go to our machine again and let's exit from our Tomcat vagrant machine and that is because this machine has Tomcat already installed and we want to demonstrate how we can install Jenkins as a standalone as a standalone application. So instead of removing Tomcat from this machine we are going to create a new machine, a new Ubuntu machine but this time a different one that does not have anything pre installed. This machine has as we have mentioned in previous lecture it has Tomcat Apache and Mysql already installed. So let's halt this machine. And vagrant halt as you can see here is just going to suspend or to shutdown the machine. As you can see it is very easy to shut down the machine from outside. And it's also very easy to create new machine as we are going to see in a moment. So we are now inside tomcat. Let's go one directory up and create another directory and lets call it Ubuntu. Ok since you have already an Ubuntu lets ensure that it does not have any vagrant file no it does not have. So let's vagrantinit. And this time I'm going to use a box that is called bento/Ubuntu-16.10 which is the latest version of Ubuntu at the time of this recording. And again lets ensure that port 8080 is being forwarded. Let's use a different port for this case just to show you that this is a different installation. So let's use instead of 8080 we are going to use 8888. So whenever anybody accesses port 8888 on localhost the traffic will be automatically forwarded to port 8080 on guest which of course is going to be handled by Jenkins. Okay. Once done. Lets one vagrant up. And again if you have this box already installed or already downloaded on your machine it is going just to import or deploy a vagrant machine out of it. If you don't have this box installed already on your system it is going to download it from the internet. Once it is downloaded it's not going to be downloaded again. Just one time and it's going to be saved on your file system for subsequent uses. In my case I have already downloaded this box because I use it in many of my labs and now it's forwarding the ports, setting up the machine. Okay and now the machine has been started correctly, successfully. Let's clear the screen and let's vagrant ssh inside that machine. Okay i am inside as you can see here I don't have any Tomcat or Apache as you can see here I have no I have nothing installed in this machine just a plain old native Ubuntu installation. We're going to use it to install a Debian Package of Jenkins. And again I have more than one option. I can go to Jenkins and download the binary Debian Package as you can see here. If I click on this link as you can see here I am presented with a large number of Debian packages for different versions of Jenkins latest of which is of course 2.7.4. I can download this Debian file on my machine and I can use a command like the pkg to install this Debian package. I can also use the apt get command to install Jenkins and using apt get is highly recommended if you are using Ubuntu the same way as young is recommended if you are using a redhat based machine that is because those are called package managers. A Package manager can handle dependencies, can handle download, can resume broken downloads, it can do lots of things that instead of doing it yourself instead of doing it manually. So let's just use the command that Jenkins has generously provided for us on the Help page. I am going to first import the key to use to add repository to my list of repositories of the Ubuntu. So this command is going to just download and import the key using aptget. And next thing is I need to add this line /etc/apt/source.list. This is to enable apt get to look at this repository for the packages that install Jenkins. So I need to be a root for doing this. So i am going to use sudu then vim, vim is my favourite text editor but Of course you can use whatever editor you need. However whatever editor you choose like nano for example. So /etc/apt/sources.list and go to the end of the file and add this line. Save. Then all what you have to do is do sudo apt-get update in order to update the different repositories including the one that we have already added which is the Jenkins source. It's going to take just a few seconds to complete. Once done I can just add more sudu apt-get install Jenkins and apt-get is going to do the rest for me. It's going to download all the pre requisites that are needed by Jenkins including Java because Java is not installed in this machine by default. Again this is just a plain Ubuntu installation with nothing pre installed with nothing shipped. So it is going to download and install the prerequisites that are needed to run Jenkins and of course the Jenkins package itself. So I'm going to pause the video for a few moments till this installation is complete and return back to you. Okay and the download is finished and it is actually installing Jenkins on your machine or our machine now in this case. And now everything is done just wait for a few seconds till it gives me the prompt again. Okay. And guess what. That is the only thing that you need to do to install Jenkins using a pre compiled binary file. All that I need now is just to use sudo systemcdl Start Jenkins same way you start anything on Ubuntu, Same way you start Apache or any other service on the system. So once it is done I can just use a command like lsof-i:8080 just to ensure that Java has already been started the server is started. Now I can go again to the browser and I can go to Jenkins the previous installation of course. Now this will no longer work because I have shut down the machine and I have forwarded the port to a different port which is 8888. Okay. Again this is the default installation of Jenkins. And again it is asking you for an admin password. However if you notice this path is different from the previous path. The previous path if you remember have been in the home directory of the current user which was /home/ubuntu but because this has been installed using apt-get it is installing the Jenkins files inside /var/lib/jenkins. We are going to go through that later in this class. All that you have do now is again take the admin password that is of course you need to do sudu because this time you are reading one of the system files. So you need to be root in order to do this. I'm going to copy this string, i paste it here. Just make sure that you take the whole string without any extra spaces or new lines at the end. And again it's prompting you to install plugins. Let's just skip this for a moment and start using Jenkins. And once more again you have the default admin page of Jenkins and you are prompted to create a new job which is the first thing you might want to do when you start Jenkins. And that brings us to the end of this lecture. In the coming lecture we are going to start by discussing one of the even more easier features of installing Jenkins or a more technically running Jenkins and that is by using the war file by itself without any containers without any installation just running the file. That is going to be the starting topic of next lecture. So until then. See you next.