AWS Global Infrastructure

DevOps

Topics Covered
  • DevOps (78 Blogs)
  • Mastering Git and GitHub (4 Blogs)
  • Docker (9 Blogs)
  • DevOps Engineer Masters Program (7 Blogs)
SEE MORE

Install Jenkins In 5 Simple Steps | Jenkins Installation | Edureka

Last updated on Nov 25,2020 155.3K Views

Saurabh
Saurabh is a technology enthusiast working as a Research Analyst at Edureka.... Saurabh is a technology enthusiast working as a Research Analyst at Edureka. His areas of interest are - DevOps, Artificial Intelligence, Big Data and...
2 / 5 Blog from Jenkins

Install Jenkins

In this blog, I will guide you through the installation process of Jenkins. Just follow the below steps to install Jenkins along with its suggested plugins. In case you are curious to know more about Jenkins, click here to find all the necessary details.

The complete process to install Jenkins can be summarized in five steps:

  1. Install Java Version 8 – Jenkins is a Java based application, hence Java is a must.
  2. Install Apache Tomcat Version 9 – Tomcat is required to deploy Jenkins war file.
  3. Download Jenkins war File – This war is required to install Jenkins.
  4. Deploy Jenkins war File – Jenkins war file needs to be deployed using Tomcat to run Jenkins.
  5. Install Suggested Plugins – Install a list of plugins suggested by Jenkins.

Note: These steps are for the CentOS operating system. In case you do not have a CentOS host machine you can install a CentOS VM to go ahead with the installation.

Now before moving on, go through this Jenkins installation video from our Jenkins training expert.

Jenkins Installation Tutorial For Beginners | Jenkins Installation on Linux | DevOps Tools | Edureka

Step 1: Install Java Version 8

To install Java version 8 execute the below command:

sudo yum install java-1.8.0-openjdk

Java Installation - Install Jenkins - Edureka

Step 2: Install Apache Tomcat 9

In order to install Jenkins we need to deploy the Jenkins war file by using Apache Tomcat. I will use wget command to install specific version of Apache Tomcat i.e. Tomcat 9 in this case.

First, to install wget execute the below command:

sudo yum install wget

install Wget Install Jenkins - Edureka

Now I will use wget to download the Tar file for Tomcat 9 using the below command:

wget https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.0.M10/bin/apache-tomcat-9.0.0.M10.tar.gz

Install Tomcat Tar File - Install Jenkins - Edureka

Next, I will show you how to extract the contents from this downloaded Tomcat 9 tar file. For this I will use tar command:

tar xzf apache-tomat-9.0.0.M10.tar.gz

Extract Contents From Tomcat Tar File - Install Jenkins - Edureka

To make it simple I will move this extracted file to a new directory Tomcat9 using the mv command and to do that I will execute the following command: 

mv apache-tomcat-9.0.0.M10 tomcat9

Move Tomcat - Install Jenkins - Edureka

Our next step is to provide a username and password for Apache Tomcat and for that I will use gedit editor, you can use any other editor as per your comfort.

gedit /home/edureka/tomcat9/conf/tomcat-users.xml

Tomcat users.xml File - Install Jenkins - Edureka

Now delete the content of the tomcat-users.xml file. Copy the below block and paste it in tomcat-users.xml file. 

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
    <role rolename="manager-gui"/>
    <role rolename="manager-script"/>
    <role rolename="manager-jmx"/>
    <role rolename="manager-jmx"/>
    <role rolename="admin-gui"/>
    <role rolename="admin-script"/>
    <user username="edureka" password="edureka" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-gui,admin-script"/>
</tomcat-users>

The updated tomcat-users.xml file will look like this:

users-xml File - Install Jenkins - Edureka

In the above image, as you can see that I have defined several roles and for all these roles I have given one single username and password i.e. edureka. If you want to assign different username and password for different roles you can do that as well.

Now save it and close the file to go back to the terminal.

 

We need to start Apache Tomcat now, but before that I will change my directory to Tomcat9 by executing the below command:

cd tomcat9

To start Tomcat use the below command:

./bin/startup.sh

Start Tomcat - Install Jenkins - Edureka

So, Tomcat has now started.

Now open your browser and access localhost:8080 to confirm that Tomcat is up and running. For your information port 8080 is the default port for Apache Tomcat.

Tomcat Interface - Install Jenkins - Edureka

Step 3: Download Jenkins war File

I will again use the wget command to download Jenkins war (web archive) file. To get the release list of Jenkins war you can use the URL Jenkins releases

Jenkins War Release - Install Jenkins - Edureka

Here copy the link location of the version of Jenkins that you wish to install. I will install Jenkins version 2.7.3, which is highlighted in the snapshot.

Go back to the terminal and move to the home directory by executing the below command.

cd

Now download Jenkins war file by using wget command:

wget http://updates.jenkins-ci.org/download/war/2.7.3/jenkins.war

install-jenkins-war-install-jenkins-edureka

Step 4: Deploy Jenkins war File 

To deploy Jenkins war file that you have downloaded in the previous step, open your browser and access localhost:8080 again. Now click on the Manager App.

Tomcat Manager App - Install Jenkins - Edureka

When you click on the Manager app, it will ask for username and password. If you remember I have given one single username and password for all the roles i.e. edureka. Type the below mentioned username and password and click OK.

  • Username: edureka
  • Password: edureka

Now you will be directed to  Tomcat web application manager page. When you scroll down you will find an option called Deploy. Over here you need to give the context path, i.e. /jenkins and directory URL, i.e. location of the Jenkins war file in your system in my case it is /home/edureka/jenkins.war and finally click on Deploy.

deploy-jenkins-war-install-jenkins-edureka

Now in the Tomcat web application manager page you can find Jenkins listed under Applications along with other web apps.

Jenkins war - Install Jenkins - Edureka

Now I will click on “/jenkins” which is highlighted in the above image.

Step 5: Install Suggested Plugins 

When I clicked on jenkins I was directed to Unlock Jenkins page. Please refer to the below snapshot:

Unlock Jenkins - Install Jenkins - Edureka

In order to unlock Jenkins first copy the part that I have highlighted in the screenshot above. This is the location that contains your one time password for Jenkins i.e. /home/edureka/.jenkins/secrets/initialAdminPassword in my case, it will be different for you. Hence, just copy the path from the screen on your end and go back to the terminal.

Finally, use the following command to get your one time password:

cat <paste the location that you have copied>

This cat command will read the contents of the file that contains the one time password and will display it on the terminal.

One Time - Jenkins Password - Install Jenkins - Edureka

Just copy this password and paste it in the Administrator password text-box in the Unlock Jenkins page. Please refer to the below snapshot. 

Paste One Time Password - Install Jenkins - Edureka

Once you have pasted the password, click on continue.

Now I will install plugins. As you see in the below snapshot there are two options i.e. either I can go with suggested plugins or I can select plugins on my own.

Instal Plugine - Install Jenkins - Edureka

I will go with Install Suggested Plugins.

Snapshot below will give you a list of plugins that will be installed when you click on Install Suggested Plugins.

Install Suggested Plugins - Install Jenkins - Edureka

Once the plugins are installed, you will be directed to a page where you have to Create First Admin User. Please fill your relevant details.

Admin Form - Install Jenkins - Edureka

After filling this form, click on save and finish.

Start Jenkins - Install Jenkins - Edureka

Congratulations! Jenkins is ready now, once you click on start using Jenkins you will be directed to Jenkins dashboard. You can now use Jenkins to continuously trigger build and test for every change made in the source code.

Jenkins Installed - Install Jenkins - Edureka

I hope you were able to follow the Jenkins Installation guide and by now Jenkins must be up and running on your machine, check out the DevOps training by Edureka, a trusted online learning company with a network of more than 250,000 satisfied learners spread across the globe. The Edureka DevOps Certification Training course helps learners gain expertise in various DevOps processes and tools such as Puppet, Jenkins, Nagios and GIT for automating multiple steps in SDLC.

Got a question for us? Please mention it in the comments section and we will get back to you.

Upcoming Batches For DevOps Certification Training Course
Course NameDate
DevOps Certification Training Course

Class Starts on 21st January,2023

21st January

SAT&SUN (Weekend Batch)
View Details
DevOps Certification Training Course

Class Starts on 30th January,2023

30th January

MON-FRI (Weekday Batch)
View Details
DevOps Certification Training Course

Class Starts on 20th February,2023

20th February

MON-FRI (Weekday Batch)
View Details
Comments
12 Comments

Join the discussion

Browse Categories

webinar REGISTER FOR FREE WEBINAR
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP

Subscribe to our Newsletter, and get personalized recommendations.

image not found!
image not found!

Install Jenkins In 5 Simple Steps | Jenkins Installation | Edureka

edureka.co