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.
sudo yum install java-1.8.0-openjdk.x86_64
- Now , after installing the java check the version of the java.
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.
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
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:
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
yum install jenkins
Output:
- Start the Jenkins service
Commands:
sudo chkconfig jenkins on
sudo service jenkins start
Output:
- 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