<img alt="" src="https://secure.leadforensics.com/150446.png " style="display:none;">
Go to top icon

Install and configure Jenkins in CentOS 6.8

Surbhi Agarwal Jul 05, 2018
What is Jenkins?

In DevOps, continuous integration is very important where the developer merge their code into a central repository several times after which automated builds and tests are run.

So, Jenkins is one of the continuous integration tool. It is written in java, an open source automation tool and eassy to install. It is used to build and test the software continuously. The developers make changes in the projects as per the errors in the build and again fresh build is given and conditions are tested. This process goes on till we get the successful build.

Continuous Integration in Jenkins is achieved with the help of the different Plugins . There are 1000+ plugins available which can be integrated at various DevOps stages.
For example: Git, Maven, SVN, Mercurial, HTML publisher and many more.

Jenkins is free and portable to all the major platforms. We can make different types of projects with jenkins.
For example: Freestyle software, Maven, pipeline, Muti-configuration projects and many more.

Installing Jenkins- Prerequisites:

Step1:

Update your system

Command:
sudo yum install epel-release
sudo yum update

Step 2:

Install JAVA

  • To install Jenkins in your system you need to install java first.
Command:
sudo yum install java-1.8.0-openjdk.x86_64

  • Now , after installing the java check the version of the java.
Command:
java -version

Output:
openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-b10)
OpenJDK 64-Bit Server VM (build 25.171-b10, mixed mode)

  • To help java based applications, to find java in the system we need to set two environment variables.
1. JAVA_HOME
2. JRE_HOME

Commands:
i. sudo cp /etc/profile /etc/profile_backup
ii. echo 'export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk' |
sudo tee -a /etc/profile

Output:
export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk
iii. echo 'export JRE_HOME=/usr/lib/jvm/jre' | sudo tee -a /etc/profile

Output:
export JRE_HOME=/usr/lib/jvm/jre
iv. source /etc/profile

  • To review them
Command:
echo $JAVA_HOME
echo $JRE_HOME

How to install Jenkins in CentOS 6.8

Commands:
cd~
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo

Output:
output
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key

yum install jenkins

Output:
output2
  • Start the Jenkins service

    Commands:
    sudo chkconfig jenkins on
    sudo service jenkins start

    Output:
output 3
  • To stop and check the status of Jenkins use

    Commands:
    sudo service jenkins stop
    sudo service jenkins status

  • Jenkins run on port 8080 check it if open or not by

    Command:
    netstat -ntpl

  • Now time to run Jenkins on browser

    http://<IP address of machine>:8080
  • When you will first run Jenkins, you will see this page

  • To find the password

    Command:

    sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Output 5This is how we install Jenkins. Please drop your questions in the comment section below, I would be happy to you.

e-Zest is a leading digital innovation partner for enterprises and technology companies that utilizes emerging technologies for creating engaging customers experiences. Being a customer-focused and technology-driven company, it always helps clients in crafting holistic business value for their software development efforts. It offers software development and consulting services for cloud computing, enterprise mobility, big data and analytics, user experience and digital commerce.