In this tutorial we will learn, how to install openJDK and Jenkins in CentOS6.5 and how to configured jobs in Jenkins.
We need:
1. CentOS6.5 Installed in your system
2. Have root level access
3. Internet access in your system for downloading the required files
Installing the java-1.7.0-openjdk
For installing the java you have to type the bellow command:
[root@dev]# yum install java-1.7.0-openjdk
...
[root@dev]# java -version
[root@dev]# java -version
java version "1.7.0_95"
OpenJDK Runtime Environment (rhel-2.6.4.0.el6_7-x86_64 u95-b00)
OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)
Installation of a stable version of Jenkins
wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
yum install jenkins
Start/Stop
service jenkins start/stop/restart
chkconfig jenkins on
Start the Jenkins
service jenkins start
Verify Jenkins is running or not?
[root@dev]# ps -ef | grep jenkins
root 3912 1939 0 20:17 pts/0 00:00:00 grep jenkins
jenkins 8331 1 5 19:41 ? 00:01:58 /etc/alternatives/java -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true -DJENKINS_HOME=/var/
lib/jenkins -jar /usr/lib/jenkins/jenkins.war --logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenkins/war --daemon --httpPort=8080 --ajp13
Port=8009 --debug=5 --handlerCountMax=100 --handlerCountMaxIdle=20
Note: I'm running CentOS with vagrant and virtual box so I have to do the tunneling for access the Host and port of Jenkins by putty.
Open the any browser and type the URL of Jenkins
http://localhost:8080/
Create the Jobs:
Click on the New Item
Type the Item Name First-job-in-jenkins
Select the Freestyle project
In configuration page come all the way down
Select Execute Shell from Add build step and type
ps -fe | grep jenkins
Email notification from Add post build action
Type the email Recipients
Click on the Save
Now this configuration will save
[root@dev]# vi /var/lib/jenkins/jobs/First-job-in-jenkins/config.xml
<?xml version='1.0' encoding='UTF-8'?>
<project>
<actions/>
<description></description>
<keepDependencies>false</keepDependencies>
<properties>
<jenkins.model.BuildDiscarderProperty>
<strategy class="hudson.tasks.LogRotator">
<daysToKeep>2</daysToKeep>
<numToKeep>2</numToKeep>
<artifactDaysToKeep>-1</artifactDaysToKeep>
<artifactNumToKeep>-1</artifactNumToKeep>
</strategy>
</jenkins.model.BuildDiscarderProperty>
</properties>
<scm class="hudson.scm.NullSCM"/>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers>
<hudson.triggers.TimerTrigger>
<spec></spec>
</hudson.triggers.TimerTrigger>
</triggers>
<concurrentBuild>true</concurrentBuild>
<builders>
<hudson.tasks.Shell>
<command>ps -ef | grep jenkins</command>
</hudson.tasks.Shell>
</builders>
<publishers>
<hudson.tasks.Mailer plugin="mailer@1.11">
<recipients>tutorialbyexample@gmail.com</recipients>
<dontNotifyEveryUnstableBuild>false</dontNotifyEveryUnstableBuild>
<sendToIndividuals>true</sendToIndividuals>
</hudson.tasks.Mailer>
</publishers>
<buildWrappers/>
</project>
This is all about how to install Jenkins and Java in CentOS6.5 with job creation in Jenkins.
Ref:
https://wiki.jenkins-ci.org
http://openjdk.java.net/
https://www.centos.org/
https://www.vagrantup.com/
https://www.virtualbox.org/
http://www.putty.org/
No comments:
Post a Comment