Jenkins is an opensource and most popular continuous integration
tool written in Java. There are many plugins are available to make it more
easier. It supports almost all version control systems. You can configure
builts with various means like, triggered by a commit in a version control
system, scheduling by cron -jobs, built after a specific built completes etc..
ect …
In this article I will show you how to install and configure
Jenkins on CentOS 6.4.
Step – 1
To install and configure Jenkins on CentOS we have to first
install JAVA on the machine. Below are the steps to install JAVA on CentOS.
Verify the java by issuing the below command
Now we will add Jenkins Repository to our machine.
wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
Now we will Install Jenkins
Add Jenkins to system boot
By default Jenkins will start on Port 8080. You can verify that
with the below command.
Go to your browser and type http://localhost:8080/. Now you
should able to see the Jenkins dashboard like below image.
Step – 2
Now we will setup Authentication for Jenkins. By default Jenkins
allows “Anyone can do anything.”. Here we will setup Matrix based security authentication.
For this follow the below steps:
Click on Manage Jenkins > Configure Global Security >
Jenkins Own User Database > Allow Users to Signup > Save
Step – 3
After saving the abo ve step then follow the below step to create
an user:
Click on Signup button (Top right corner of the dashboard) >
Fill all the required info rmation > click on SignUp (Below the Form)
Step – 3
Now we will restrict User Signup and add “Matrix based security
authentication”. Please follow the below steps:
Click on Manage Jenkins > Configure Global Security >
Jenkins Ow n User Database > Unchek “Allow Users to Signup” > Matrix-based
security > Put the user Name @ “User/group to add:” text box > click on
add > Check all the Check boxes > Save
Now onwards User “Tapas Mishra” can administrate Jenkins after
l ogin. Also you can add more user to the db by following the below
Step – 4
Click on Mana ge Jenkins > Manage Users > Create U
ser
s
After
thi
s follow the Step – 3 again to add previliage to the
new user.
Add nodes and configure Jobs to Start a Built
Process -- Part II
I have described in my previous article about Jenki ns and how to install and
configure user account on it. In this article I will describe about how to
configure nodes on Jenkins. Nodes are the servers where we will deploy our
applications. You can configure n number of Nodes in your Jenkins applications
depending on the server capacity.
Before configuring a node we have to add there credential first.
Like user name and pa ssword for the node if the node is passwordbased
authentication enabled. Else you can add the user name and private key if the
node is passwordless authentication enabled.
How
to add credentials
Log in to your Jenkins account. Click on the credential tab as
shown in the below image.
Now Click on “Add domain” as shown in the below image.
Provide a user friendly name and some description to it and
p ress “OK”
Now Click on “Add Credentials” tab then provide your information
as shown in the below image.
After completing the Credential entry in the Jenknins now we
will add the Node.
How to add Node on
Jenkins
Go to
the main dashboard of Jenkins Click on “Manage Jenkins” > Click on “Manage
Nodes” from the List.
You will find a Node named “Master” in the node list which is
t he Jenkins server itself.
To add a new node click on “New Node”. Enter the information and
click on as shown in the below image.
Now enter all the information about your host as shown in the
below Image. Click on the advance and modify your port number if you are using
any different port for your SSH.
It will take some time to Lunch the new node and then you will
able to see the information about the node in your Jenkins Dashboard. See the
below image.
Jenkins
- Part III
In my previous articles (Jenkins Part I and Jenkins Part II) I
have already described how to install Jenkins, how to Setup User account on
Jenkins, how to Configure Nodes on Jenkins. In this article we will see how to
configure a job on Jenkins. Basically the job will deploy an application from
Github on a configured node. We will configure a simple Job in this part. We will
just clone a github repository in a node using Jenkins. But in our later
articles we will discuss about critical deployments.
We will complete this in three steps.
- Install required Plugin
- Configure Job
- Build the Job and verify
Step 1 (Install required Plugin)
If we are using GIT as our Sour Code Management then we have to
install plugin for it. The git plugin will help use to deploy the codes on a
node. It’s v ery simple to configure. To install a plugin follow the steps as
described below
Click on Manage Jenkins > Click on Manage Plugins > Click
on Available Tab > Filter the Git Plugins > Chose the Git Plugin >
Click on install without restart. > Chose Restart Jenkins when installation
is complete option.
Step 2 (Configure Job)
Now we will create a Job for dep loying an application on our
previously configured server from github. To Create a new job C lick on New Job
> Give a Name to the Job > Choose “Build a free-style software project”
option > Click on “Ok”
After getting the new window
Check the option “Restrict
where this pro ject can be run“. You will get a text box to
enter a node name where the build will be taken place (Setup a node fo llowing
the steps in my previous article).
Write the node nam e in my case it’s “www.linuxfunda.com“. If you will not check this
option then Jenkins will clone your repository in Master itself.
Chose the Git Radio button
from the “Source
Code Management” section and write the Github Repository URL. In my case it’s “ https://github.com/tapasprivate/tapasprivate.git “.
I have described how to add Cre dentials in my previous article.
Add the appropriate credential for the github account. Specify the branch name
if you want any specific branch to clone else it will clone “master”
branch of the repository. There are also other advance options are available
like git submodules which we will discuss in later articles.
Step 3 (Build the Job and
Verify)
Now we have done with the configuration of the job. Save the
Configuration and build the job. SSH to your node where you took the bu ild. Go
to the Workspace path and verify that your files are t here from github. In my
next article we will configure a job with shell script.
No comments:
Post a Comment