How to install and Configure Jenkins on CentOS

Jenkins is free and open source continues integration tool and it’s code is written in Java. It provides the feature of continues build and deployment or in other words we can say it is a automation server. Jenkins are used where continues build and integration is going on for software development.
Add Jenkins Repository
Jenkins package is not available in the default CentOS and RHEL repositories. So we need to add jenkins repository using the beneath commands.
 wget -O /etc/yum.repos.d/jenkins.repo
rpm –import
Install Jenkins and Java
Run the below  yum command to install Jenkins and java.
yum install jenkins java-1.7.0-openjdk –y
Start and Enable Jenkins Service
Run the following systemctl commands to start and enable the jenkins service
service jenkins restart
chkconfig jenkins on

Admin password is created and stored in the log file  “/var/log/jenkins/jenkins.log“. Run the below command to get the password.
grep -A 5 password /var/log/jenkins/jenkins.log
Copy the password and paste it in above windows and click on Continue..
In the next windows Select the option : Install suggested plugins

As we can see required plugin installation is in progress for Jenkins. Once it is done with plugin installation. It will ask to create Admin User

Click on Save and Finish
click on “Start using Jenkins

Now Configure GitHub project using git plugin in Jenkins.
Let’s Assume I have a ‘kosecurity’ project on GitHub and wants to integrate this project in Jenkins using git plugin.
Let’s first install git package on your machine on which you have installed Jenkins because Jenkins use git command to pull the GitHub project code.
yum install git –y
Login to the GitHub and get the Web URL of your project.

In the Next step click on the “Build Now” option from Jenkins Dashboard to pull the GitHub Project Code.

Click on the Workspace Option to view Code or files of GitHub Project. Whenever a new code is pushed on the GitHub project it will be automatically push to Jenkins workspace with new versions.



  1. mkdir -p /home/funclubs/${JOB_NAME}/
    mkdir -p /home/funclubs/${JOB_NAME}/${BUILD_NUMBER}
    mkdir -p /home/funclubs/${JOB_NAME}/${BUILD_NUMBER}/new
    mkdir -p /home/funclubs/${JOB_NAME}/${BUILD_NUMBER}/old
    cp -r . /home/funclubs/${JOB_NAME}/${BUILD_NUMBER}/new
    rm -rf /home/funclubs/${JOB_NAME}/${BUILD_NUMBER}/new/.git
    cp -r /home/funclubs/${JOB_NAME}/${BUILD_NUMBER}/new/* /var/www/html/kosecurity/
    cd /home/funclubs/${JOB_NAME}/${BUILD_NUMBER}/new/
    zip -r -v “$(date +”%y-%m-%d”).zip” *

    sudo mkdir -p /home/funclubs/${JOB_NAME}/
    sudo mkdir -p /home/funclubs/${JOB_NAME}/${BUILD_NUMBER}
    sudo mkdir -p /home/funclubs/${JOB_NAME}/${BUILD_NUMBER}/new
    sudo mkdir -p /home/funclubs/${JOB_NAME}/${BUILD_NUMBER}/old
    sudo cp -r . /home/funclubs/${JOB_NAME}/${BUILD_NUMBER}/new
    sudo rm -rf /home/funclubs/${JOB_NAME}/${BUILD_NUMBER}/new/.git
    sudo cp -r /home/funclubs/${JOB_NAME}/${BUILD_NUMBER}/new/* /var/www/html/kosecurity/
    sudo cd /home/funclubs/${JOB_NAME}/${BUILD_NUMBER}/new/
    sudo zip -r -v “$(date +”%y-%m-%d”).zip” *

Leave a Reply

Your email address will not be published.